mirror of https://github.com/halo-dev/halo-admin
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 https://github.com/halo-dev/halo/issues/3376 #### Special notes for your reviewer: 测试方式: 1. 测试添加若干分类和标签,观测在没有生成 permalink 的情况下,是否会自动刷新列表。 #### Does this PR introduce a user-facing change? ```release-note 优化 Console 端分类和标签管理的自动刷新条件,支持检测固定链接是否已经生成。 ```pull/884/head^2
parent
6244e8b5c0
commit
a8166e5336
|
@ -34,10 +34,11 @@ export function usePostCategory(): usePostCategoryReturn {
|
|||
return data.items;
|
||||
},
|
||||
refetchInterval(data) {
|
||||
const deletingCategories = data?.filter(
|
||||
(category) => !!category.metadata.deletionTimestamp
|
||||
const abnormalCategories = data?.filter(
|
||||
(category) =>
|
||||
!!category.metadata.deletionTimestamp || !category.status?.permalink
|
||||
);
|
||||
return deletingCategories?.length ? 3000 : false;
|
||||
return abnormalCategories?.length ? 3000 : false;
|
||||
},
|
||||
refetchOnWindowFocus: false,
|
||||
onSuccess(data) {
|
||||
|
|
|
@ -28,10 +28,10 @@ export function usePostTag(): usePostTagReturn {
|
|||
return data.items;
|
||||
},
|
||||
refetchInterval(data) {
|
||||
const deletingTags = data?.filter(
|
||||
(tag) => !!tag.metadata.deletionTimestamp
|
||||
const abnormalTags = data?.filter(
|
||||
(tag) => !!tag.metadata.deletionTimestamp || !tag.status?.permalink
|
||||
);
|
||||
return deletingTags?.length ? 3000 : false;
|
||||
return abnormalTags?.length ? 3000 : false;
|
||||
},
|
||||
refetchOnWindowFocus: false,
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue