|
@@ -245,6 +245,7 @@ const Page: NextPageWithLayout<Props> = (props: Props) => {
|
|
|
const { pageWithMeta } = props;
|
|
const { pageWithMeta } = props;
|
|
|
|
|
|
|
|
const pageId = pageWithMeta?.data._id;
|
|
const pageId = pageWithMeta?.data._id;
|
|
|
|
|
+ const revisionId = pageWithMeta?.data.revision?._id;
|
|
|
const revisionBody = pageWithMeta?.data.revision?.body;
|
|
const revisionBody = pageWithMeta?.data.revision?.body;
|
|
|
|
|
|
|
|
useCurrentPathname(props.currentPathname);
|
|
useCurrentPathname(props.currentPathname);
|
|
@@ -277,7 +278,7 @@ const Page: NextPageWithLayout<Props> = (props: Props) => {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (currentPageId != null && !props.isNotFound) {
|
|
|
|
|
|
|
+ if (currentPageId != null && revisionId != null && !props.isNotFound) {
|
|
|
const mutatePageData = async() => {
|
|
const mutatePageData = async() => {
|
|
|
const pageData = await mutateCurrentPage();
|
|
const pageData = await mutateCurrentPage();
|
|
|
mutateEditingMarkdown(pageData?.revision?.body);
|
|
mutateEditingMarkdown(pageData?.revision?.body);
|
|
@@ -288,7 +289,10 @@ const Page: NextPageWithLayout<Props> = (props: Props) => {
|
|
|
// Because pageWIthMeta does not contain revision.body
|
|
// Because pageWIthMeta does not contain revision.body
|
|
|
mutatePageData();
|
|
mutatePageData();
|
|
|
}
|
|
}
|
|
|
- }, [currentPageId, mutateCurrentPage, mutateCurrentPageYjsDataFromApi, mutateEditingMarkdown, props.isNotFound, props.skipSSR]);
|
|
|
|
|
|
|
+ }, [
|
|
|
|
|
+ revisionId, currentPageId, mutateCurrentPage,
|
|
|
|
|
+ mutateCurrentPageYjsDataFromApi, mutateEditingMarkdown, props.isNotFound, props.skipSSR,
|
|
|
|
|
+ ]);
|
|
|
|
|
|
|
|
// sync pathname by Shallow Routing https://nextjs.org/docs/routing/shallow-routing
|
|
// sync pathname by Shallow Routing https://nextjs.org/docs/routing/shallow-routing
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
@@ -308,8 +312,8 @@ const Page: NextPageWithLayout<Props> = (props: Props) => {
|
|
|
}, [mutateEditingMarkdown, revisionBody, props.currentPathname]);
|
|
}, [mutateEditingMarkdown, revisionBody, props.currentPathname]);
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
- mutateRemoteRevisionId(pageWithMeta?.data.revision?._id);
|
|
|
|
|
- }, [mutateRemoteRevisionId, pageWithMeta?.data.revision?._id]);
|
|
|
|
|
|
|
+ mutateRemoteRevisionId(revisionId);
|
|
|
|
|
+ }, [mutateRemoteRevisionId, revisionId]);
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
mutateCurrentPageId(pageId ?? null);
|
|
mutateCurrentPageId(pageId ?? null);
|