jam411 3 gadi atpakaļ
vecāks
revīzija
85c5da3d1c

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

@@ -13,7 +13,7 @@ import { HtmlElementNode } from 'rehype-toc';
 import { toastSuccess, toastError } from '~/client/util/apiNotification';
 import { getOptionsToSave } from '~/client/util/editor';
 import {
-  useIsGuestUser, useShareLinkId,
+  useIsGuestUser, useShareLinkId, useIsLatestRevision, useStaticPageData,
 } from '~/stores/context';
 import {
   useSWRxSlackChannels, useIsSlackEnabled, usePageTagsForEditors, useIsEnabledUnsavedWarning,
@@ -224,9 +224,9 @@ export const Page = (props) => {
   const { mutate: mutateIsEnabledUnsavedWarning } = useIsEnabledUnsavedWarning();
   const { mutate: mutateCurrentPageTocNode } = useCurrentPageTocNode();
 
-  // // for History "View this version" function on PageAccessoryModal
-  // const { data: isLatestRevision } = useIsLatestRevision();
-  // const { data: pageWithMetaData } = useStaticPageData();
+  // for History "View this version" function on PageAccessoryModal
+  const { data: isLatestRevision } = useIsLatestRevision();
+  const { data: pageWithMetaData } = useStaticPageData();
 
   const pageRef = useRef(null);
 
@@ -274,14 +274,14 @@ export const Page = (props) => {
     return null;
   }
 
-  // const page = ((pageWithMetaData != null && isLatestRevision != null) && !isLatestRevision) ? pageWithMetaData : currentPage;
+  const page = ((pageWithMetaData != null && isLatestRevision != null) && !isLatestRevision) ? pageWithMetaData : currentPage;
 
   return (
     <PageSubstance
       {...props}
       ref={pageRef}
       rendererOptions={rendererOptions}
-      // page={page}
+      page={page}
       editorMode={editorMode}
       isGuestUser={isGuestUser}
       isMobile={isMobile}

+ 3 - 0
packages/app/src/components/PageHistory/Revision.tsx

@@ -3,6 +3,7 @@ import React from 'react';
 import { IRevisionHasId } from '@growi/core';
 import { UserPicture } from '@growi/ui';
 import { useTranslation } from 'next-i18next';
+import Link from 'next/link';
 
 import UserDate from '../User/UserDate';
 import { Username } from '../User/Username';
@@ -60,9 +61,11 @@ export const Revision = (props: RevisionProps): JSX.Element => {
           <div className="mb-1">
             <UserDate dateTime={revision.createdAt} />
             <br className="d-xl-none d-block" />
+            {/* <Link href={`?revisionId=${revision._id}`} prefetch={false}> */}
             <a className="ml-xl-3" href={`?revisionId=${revision._id}`}>
               <i className="icon-login"></i> { t('Go to this version') }
             </a>
+            {/* </Link> */}
           </div>
         </div>
       </div>

+ 2 - 1
packages/app/src/pages/[[...path]].page.tsx

@@ -66,6 +66,7 @@ import {
   useCsrfToken, useIsSearchScopeChildrenAsDefault, useCurrentPageId, useCurrentPathname,
   useIsSlackConfigured, useRendererConfig, useEditingMarkdown,
   useEditorConfig, useIsAllReplyShown, useIsUploadableFile, useIsUploadableImage, useCustomizedLogoSrc, useIsContainerFluid,
+  useStaticPageData,
 } from '../stores/context';
 
 import {
@@ -244,7 +245,7 @@ const GrowiPage: NextPage<Props> = (props: Props) => {
 
   const { data: currentPage } = useSWRxCurrentPage(undefined, pageWithMeta?.data ?? null); // store initial data
   useEditingMarkdown(pageWithMeta?.data.revision?.body ?? '');
-  // useStaticPageData(pageWithMeta?.data); // store page data statically for History function on PageAccessoryModal
+  useStaticPageData(pageWithMeta?.data); // store page data statically for History function on PageAccessoryModal
 
   const { data: grantData } = useSWRxIsGrantNormalized(pageId);
   const { mutate: mutateSelectedGrant } = useSelectedGrant();