Skip to content

Commit

Permalink
fix: can not refetch when request parameters changed (#35)
Browse files Browse the repository at this point in the history
修复在插件安装的界面中,切换查询参数之后一直处于加载中状态的问题。

<img width="1017" alt="image" src="https://github.com/halo-dev/plugin-app-store/assets/21301288/d139a05e-a8aa-4680-9b7e-a3453c5ed15e">

/kind bug

```release-note
修复在插件安装的界面中,切换查询参数之后一直处于加载中状态的问题。
```
  • Loading branch information
ruibaby authored Sep 25, 2023
1 parent f7736e7 commit 64bbe0f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
6 changes: 4 additions & 2 deletions console/src/components/AgreementsModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,17 @@ const { isLoading, mutate } = useMutation({
</script>

<template>
<VModal v-model:visible="visible" mount-to-body title="条款与协议">
<VModal v-model:visible="visible" title="条款与协议">
<p class="as-mb-6 as-text-sm as-text-gray-500">
为了更好的保护您的权益,请在使用 Halo 应用市场前,仔细阅读并同意以下条款与协议。
</p>
<FormKit id="agreements-form" type="form" name="agreements-form" @submit="mutate">
<FormKit v-model="formState.termsOfService" type="checkbox">
<template #label>
<span class="formkit-label formkit-invalid:text-red-500 as-block as-text-sm as-font-medium as-text-gray-700">
我已阅读并同意:<a href="https://www.halo.run/terms-of-service" target="_blank">《Halo 应用市场服务条款》</a>
我已阅读并同意:<a href="https://www.halo.run/terms-of-service" target="_blank">
《Halo 应用市场服务条款》
</a>
</span>
</template>
</FormKit>
Expand Down
10 changes: 2 additions & 8 deletions console/src/components/AppStoreTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import AppDetailModal from "./AppDetailModal.vue";
import { nextTick } from "vue";
import type { ApplicationSearchResult, ListResponse } from "@/types";
import storeApiClient from "@/utils/store-api-client";
import { useElementVisibility } from "@vueuse/core";
import { computed } from "vue";
import AgreementsModal from "./AgreementsModal.vue";
const props = withDefaults(
Expand All @@ -45,9 +43,6 @@ const viewTypes = [
const viewType = useLocalStorage<string>("app-store-tab-list-view", "list");
const tabWrapper = ref<HTMLElement | null>(null);
const tabWrapperIsVisible = useElementVisibility(tabWrapper);
const keyword = ref("");
const page = ref(1);
const size = ref(20);
Expand Down Expand Up @@ -76,7 +71,6 @@ const { data, isFetching, isLoading, refetch } = useQuery<ListResponse<Applicati
page.value = data.page;
size.value = data.size;
},
enabled: computed(() => tabWrapperIsVisible.value),
});
// detail modal
Expand Down Expand Up @@ -130,7 +124,7 @@ watch([selectedPriceMode, selectedSort, keyword], () => {
</script>

<template>
<div ref="tabWrapper">
<div>
<div class="as-block as-w-full as-rounded as-bg-gray-50 as-px-3 as-py-2">
<div class="as-relative as-flex as-flex-col as-items-start sm:as-flex-row sm:as-items-center">
<div class="as-flex as-w-full as-flex-1 as-items-center sm:as-w-auto">
Expand Down Expand Up @@ -243,5 +237,5 @@ watch([selectedPriceMode, selectedSort, keyword], () => {
</template>
</AppDetailModal>

<AgreementsModal v-if="data" />
<AgreementsModal />
</template>

0 comments on commit 64bbe0f

Please sign in to comment.