Skip to content

Commit

Permalink
fix: tag filter list not refresh (#84)
Browse files Browse the repository at this point in the history
#### What type of PR is this?

/kind bug

#### What this PR does / why we need it:

修复标签过滤列表在不刷新页面的情况下,无法获取最新新增的标签数据。

#### How to test it?

1. 在瞬间页面新增一个标签
2. 在不刷新页面的时候,查看标签列表是否更新。

#### Does this PR introduce a user-facing change?
```release-note
None
```
  • Loading branch information
LIlGG authored Feb 21, 2024
1 parent 1d7e693 commit 95689c9
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions console/src/components/TagFilterDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ const emit = defineEmits<{
(event: "update:modelValue", value?: string): void;
}>();
const page = ref(1);
const size = ref(20);
const keyword = ref<string | undefined>(undefined);
const keyword = ref(undefined);
const { data: tags } = useQuery<string[]>({
queryKey: ["tags", page, size, keyword],
const { data: tags, refetch } = useQuery<string[]>({
queryKey: ["moments-tags"],
queryFn: async () => {
const { data } = await apiClient.get(
"/apis/console.api.moment.halo.run/v1alpha1/tags",
Expand All @@ -41,7 +39,6 @@ const { data: tags } = useQuery<string[]>({
);
return data;
},
refetchOnWindowFocus: false,
});
const searchResults = computed(() => tags.value || []);
Expand All @@ -65,7 +62,7 @@ const handleCloseTag = (event: Event) => {
</script>

<template>
<VDropdown ref="dropdown" :classes="['!p-0']">
<VDropdown ref="dropdown" :classes="['!p-0']" @show="refetch">
<div
class="tag-filter-label moments-group"
:class="{ 'font-semibold text-gray-700': modelValue !== undefined }"
Expand Down

0 comments on commit 95689c9

Please sign in to comment.