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

Commit

Permalink
perf: improve the conditions for categories and tags automatic refresh (
Browse files Browse the repository at this point in the history
#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 端分类和标签管理的自动刷新条件,支持检测固定链接是否已经生成。
```
  • Loading branch information
ruibaby authored Feb 24, 2023
1 parent 6244e8b commit a8166e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions src/modules/contents/posts/tags/composables/use-post-tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down

1 comment on commit a8166e5

@vercel
Copy link

@vercel vercel bot commented on a8166e5 Feb 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ui – ./

halo-admin-ui.vercel.app
ui-git-main-halo-dev.vercel.app
ui-halo-dev.vercel.app

Please sign in to comment.