|
|
@@ -409,19 +409,21 @@ export const useIsAbleToShowPageManagement = (): SWRResponse<boolean, Error> =>
|
|
|
const { data: currentPageId } = useCurrentPageId();
|
|
|
const { data: isTrashPage } = useIsTrashPage();
|
|
|
const { data: isSharedUser } = useIsSharedUser();
|
|
|
+ const { data: isNotFound } = useIsNotFound();
|
|
|
|
|
|
const pageId = currentPageId;
|
|
|
- const includesUndefined = [pageId, isTrashPage, isSharedUser].some(v => v === undefined);
|
|
|
- const isPageExist = pageId != null;
|
|
|
+ const includesUndefined = [pageId, isTrashPage, isSharedUser, isNotFound].some(v => v === undefined);
|
|
|
+ const isPageExist = (pageId != null) && !isNotFound;
|
|
|
|
|
|
return useSWRImmutable(
|
|
|
- includesUndefined ? null : key,
|
|
|
+ includesUndefined ? null : [key, pageId],
|
|
|
() => isPageExist && !isTrashPage && !isSharedUser,
|
|
|
);
|
|
|
};
|
|
|
|
|
|
export const useIsAbleToShowTagLabel = (): SWRResponse<boolean, Error> => {
|
|
|
const key = 'isAbleToShowTagLabel';
|
|
|
+ const { data: pageId } = useCurrentPageId();
|
|
|
const { data: isUserPage } = useIsUserPage();
|
|
|
const { data: currentPagePath } = useCurrentPagePath();
|
|
|
const { data: isIdenticalPath } = useIsIdenticalPath();
|
|
|
@@ -434,7 +436,7 @@ export const useIsAbleToShowTagLabel = (): SWRResponse<boolean, Error> => {
|
|
|
const isViewMode = editorMode === EditorMode.View;
|
|
|
|
|
|
return useSWRImmutable(
|
|
|
- includesUndefined ? null : [key, editorMode],
|
|
|
+ includesUndefined ? null : [key, editorMode, pageId],
|
|
|
// "/trash" page does not exist on page collection and unable to add tags
|
|
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
|
() => !isUserPage && !isTrashTopPage(currentPagePath!) && shareLinkId == null && !isIdenticalPath && !(isViewMode && isNotFound),
|
|
|
@@ -458,14 +460,15 @@ export const useIsAbleToShowPageEditorModeManager = (): SWRResponse<boolean, Err
|
|
|
|
|
|
export const useIsAbleToShowPageAuthors = (): SWRResponse<boolean, Error> => {
|
|
|
const key = 'isAbleToShowPageAuthors';
|
|
|
- const { data: currentPageId } = useCurrentPageId();
|
|
|
+ const { data: pageId } = useCurrentPageId();
|
|
|
const { data: isUserPage } = useIsUserPage();
|
|
|
+ const { data: isNotFound } = useIsNotFound();
|
|
|
|
|
|
- const includesUndefined = [currentPageId, isUserPage].some(v => v === undefined);
|
|
|
- const isPageExist = currentPageId != null;
|
|
|
+ const includesUndefined = [pageId, isUserPage, isNotFound].some(v => v === undefined);
|
|
|
+ const isPageExist = (pageId != null) && !isNotFound;
|
|
|
|
|
|
return useSWRImmutable(
|
|
|
- includesUndefined ? null : key,
|
|
|
+ includesUndefined ? null : [key, pageId],
|
|
|
() => isPageExist && !isUserPage,
|
|
|
);
|
|
|
};
|