Skip to content
This repository was archived by the owner on Jan 21, 2024. It is now read-only.

Commit a8166e5

Browse files
authored
perf: improve the conditions for categories and tags automatic refresh (#883)
#### What type of PR is this? /kind improvement #### What this PR does / why we need it: 优化分类和标签管理页面自动刷新的条件,现在支持检测 `status.permalink` 是否已经生成完毕,如果没有会自动刷新列表。 #### Which issue(s) this PR fixes: Fixes halo-dev/halo#3376 #### Special notes for your reviewer: 测试方式: 1. 测试添加若干分类和标签,观测在没有生成 permalink 的情况下,是否会自动刷新列表。 #### Does this PR introduce a user-facing change? ```release-note 优化 Console 端分类和标签管理的自动刷新条件,支持检测固定链接是否已经生成。 ```
1 parent 6244e8b commit a8166e5

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/modules/contents/posts/categories/composables/use-post-category.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ export function usePostCategory(): usePostCategoryReturn {
3434
return data.items;
3535
},
3636
refetchInterval(data) {
37-
const deletingCategories = data?.filter(
38-
(category) => !!category.metadata.deletionTimestamp
37+
const abnormalCategories = data?.filter(
38+
(category) =>
39+
!!category.metadata.deletionTimestamp || !category.status?.permalink
3940
);
40-
return deletingCategories?.length ? 3000 : false;
41+
return abnormalCategories?.length ? 3000 : false;
4142
},
4243
refetchOnWindowFocus: false,
4344
onSuccess(data) {

src/modules/contents/posts/tags/composables/use-post-tag.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ export function usePostTag(): usePostTagReturn {
2828
return data.items;
2929
},
3030
refetchInterval(data) {
31-
const deletingTags = data?.filter(
32-
(tag) => !!tag.metadata.deletionTimestamp
31+
const abnormalTags = data?.filter(
32+
(tag) => !!tag.metadata.deletionTimestamp || !tag.status?.permalink
3333
);
34-
return deletingTags?.length ? 3000 : false;
34+
return abnormalTags?.length ? 3000 : false;
3535
},
3636
refetchOnWindowFocus: false,
3737
});

0 commit comments

Comments
 (0)