|
@@ -31,7 +31,7 @@ import type { PageRedirectModel } from '~/server/models/page-redirect';
|
|
|
import {
|
|
import {
|
|
|
useCurrentUser,
|
|
useCurrentUser,
|
|
|
useIsLatestRevision,
|
|
useIsLatestRevision,
|
|
|
- useIsForbidden, useIsNotFound, useIsSharedUser,
|
|
|
|
|
|
|
+ useIsForbidden, useIsSharedUser,
|
|
|
useIsEnabledStaleNotification, useIsIdenticalPath,
|
|
useIsEnabledStaleNotification, useIsIdenticalPath,
|
|
|
useIsSearchServiceConfigured, useIsSearchServiceReachable, useDisableLinkSharing,
|
|
useIsSearchServiceConfigured, useIsSearchServiceReachable, useDisableLinkSharing,
|
|
|
useDrawioUri, useHackmdUri, useDefaultIndentSize, useIsIndentSizeForced,
|
|
useDrawioUri, useHackmdUri, useDefaultIndentSize, useIsIndentSizeForced,
|
|
@@ -42,7 +42,9 @@ import {
|
|
|
} from '~/stores/context';
|
|
} from '~/stores/context';
|
|
|
import { useEditingMarkdown } from '~/stores/editor';
|
|
import { useEditingMarkdown } from '~/stores/editor';
|
|
|
import { useHasDraftOnHackmd, usePageIdOnHackmd, useRevisionIdHackmdSynced } from '~/stores/hackmd';
|
|
import { useHasDraftOnHackmd, usePageIdOnHackmd, useRevisionIdHackmdSynced } from '~/stores/hackmd';
|
|
|
-import { useSWRxCurrentPage, useSWRxIsGrantNormalized, useCurrentPageId } from '~/stores/page';
|
|
|
|
|
|
|
+import {
|
|
|
|
|
+ useSWRxCurrentPage, useSWRxIsGrantNormalized, useCurrentPageId, useIsNotFound,
|
|
|
|
|
+} from '~/stores/page';
|
|
|
import { useRedirectFrom } from '~/stores/page-redirect';
|
|
import { useRedirectFrom } from '~/stores/page-redirect';
|
|
|
import { useRemoteRevisionId } from '~/stores/remote-latest-page';
|
|
import { useRemoteRevisionId } from '~/stores/remote-latest-page';
|
|
|
import { useSelectedGrant } from '~/stores/ui';
|
|
import { useSelectedGrant } from '~/stores/ui';
|
|
@@ -194,7 +196,6 @@ const Page: NextPageWithLayout<Props> = (props: Props) => {
|
|
|
useIsContainerFluid(props.isContainerFluid);
|
|
useIsContainerFluid(props.isContainerFluid);
|
|
|
// useOwnerOfCurrentPage(props.pageUser != null ? JSON.parse(props.pageUser) : null);
|
|
// useOwnerOfCurrentPage(props.pageUser != null ? JSON.parse(props.pageUser) : null);
|
|
|
useIsForbidden(props.isForbidden);
|
|
useIsForbidden(props.isForbidden);
|
|
|
- useIsNotFound(props.isNotFound);
|
|
|
|
|
useIsNotCreatable(props.isNotCreatable);
|
|
useIsNotCreatable(props.isNotCreatable);
|
|
|
useRedirectFrom(props.redirectFrom ?? null);
|
|
useRedirectFrom(props.redirectFrom ?? null);
|
|
|
useIsSharedUser(false); // this page cann't be routed for '/share'
|
|
useIsSharedUser(false); // this page cann't be routed for '/share'
|
|
@@ -240,6 +241,8 @@ const Page: NextPageWithLayout<Props> = (props: Props) => {
|
|
|
|
|
|
|
|
useSWRxCurrentPage(pageWithMeta?.data ?? null); // store initial data
|
|
useSWRxCurrentPage(pageWithMeta?.data ?? null); // store initial data
|
|
|
|
|
|
|
|
|
|
+ const { mutate: mutateIsNotFound } = useIsNotFound();
|
|
|
|
|
+
|
|
|
const { mutate: mutateCurrentPageId } = useCurrentPageId();
|
|
const { mutate: mutateCurrentPageId } = useCurrentPageId();
|
|
|
|
|
|
|
|
const { mutate: mutateEditingMarkdown } = useEditingMarkdown();
|
|
const { mutate: mutateEditingMarkdown } = useEditingMarkdown();
|
|
@@ -291,6 +294,10 @@ const Page: NextPageWithLayout<Props> = (props: Props) => {
|
|
|
mutateCurrentPageId(pageId ?? null);
|
|
mutateCurrentPageId(pageId ?? null);
|
|
|
}, [mutateCurrentPageId, pageId]);
|
|
}, [mutateCurrentPageId, pageId]);
|
|
|
|
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
|
|
+ mutateIsNotFound(props.isNotFound);
|
|
|
|
|
+ }, [mutateIsNotFound, props.isNotFound]);
|
|
|
|
|
+
|
|
|
const title = generateCustomTitleForPage(props, pagePath);
|
|
const title = generateCustomTitleForPage(props, pagePath);
|
|
|
|
|
|
|
|
return (
|
|
return (
|