jam411 3 лет назад
Родитель
Сommit
3a2a075ed5

+ 2 - 2
packages/app/src/components/Page.tsx

@@ -212,9 +212,9 @@ export const Page = (props) => {
     tocRef.current = toc;
   }, []);
 
-  const { data: revisionId } = useCurrentRevisionId();
+  const { data: currentRevisionId } = useCurrentRevisionId();
   const { data: shareLinkId } = useShareLinkId();
-  const { data: currentPage } = useSWRxCurrentPage(shareLinkId ?? undefined, revisionId ?? undefined);
+  const { data: currentPage } = useSWRxCurrentPage(shareLinkId ?? undefined, currentRevisionId ?? undefined);
   const { data: editorMode } = useEditorMode();
   const { data: isGuestUser } = useIsGuestUser();
   const { data: isMobile } = useIsMobile();

+ 5 - 7
packages/app/src/pages/[[...path]].page.tsx

@@ -36,9 +36,7 @@ import type { IUserUISettings } from '~/interfaces/user-ui-settings';
 import type { PageModel, PageDocument } from '~/server/models/page';
 import type { PageRedirectModel } from '~/server/models/page-redirect';
 import type { UserUISettingsModel } from '~/server/models/user-ui-settings';
-import {
-  useSWRxCurrentPage, useSWRxIsGrantNormalized, useSWRxPageInfo,
-} from '~/stores/page';
+import { useSWRxCurrentPage, useSWRxIsGrantNormalized, useSWRxPageInfo } from '~/stores/page';
 import { useRedirectFrom } from '~/stores/page-redirect';
 import {
   EditorMode,
@@ -137,7 +135,7 @@ type Props = CommonProps & {
 
   // shareLinkId?: string;
   isLatestRevision?: boolean,
-  revisionId?: string,
+  currentRevisionId?: string,
 
   isIdenticalPathPage?: boolean,
   isForbidden: boolean,
@@ -245,9 +243,9 @@ const GrowiPage: NextPage<Props> = (props: Props) => {
   // useIsNotCreatable(props.isForbidden || !isCreatablePage(pagePath)); // TODO: need to include props.isIdentical
   useCurrentPathname(props.currentPathname);
 
-  const { data: currentPage } = useSWRxCurrentPage(undefined, props.revisionId, pageWithMeta?.data ?? null); // store initial data
+  const { data: currentPage } = useSWRxCurrentPage(undefined, props.currentRevisionId, pageWithMeta?.data ?? null); // store initial data
   useEditingMarkdown(pageWithMeta?.data.revision?.body ?? '');
-  useCurrentRevisionId(props.revisionId); // store request revisionId page data History function on PageAccessoryModal
+  useCurrentRevisionId(props.currentRevisionId); // store request revisionId page data History function on PageAccessoryModal
 
   const { data: grantData } = useSWRxIsGrantNormalized(pageId);
   const { mutate: mutateSelectedGrant } = useSelectedGrant();
@@ -418,7 +416,7 @@ async function injectPageData(context: GetServerSidePropsContext, props: Props):
   }
 
   if (typeof revisionId === 'string' || typeof revisionId === 'undefined') {
-    props.revisionId = revisionId;
+    props.currentRevisionId = revisionId;
   }
 
   props.pageWithMeta = pageWithMeta;

+ 1 - 0
packages/app/src/stores/page.tsx

@@ -142,6 +142,7 @@ export const useSWRxApplicableGrant = (
   );
 };
 
+
 /** **********************************************************
  *                     Computed states
  *********************************************************** */