Yuki Takei 3 лет назад
Родитель
Сommit
cfb72b651d
1 измененных файлов с 16 добавлено и 17 удалено
  1. 16 17
      packages/app/src/components/Page/PageView.tsx

+ 16 - 17
packages/app/src/components/Page/PageView.tsx

@@ -20,7 +20,6 @@ import { registerGrowiFacade } from '~/utils/growi-facade';
 import type { CommentsProps } from '../Comments';
 import type { CommentsProps } from '../Comments';
 import { MainPane } from '../Layout/MainPane';
 import { MainPane } from '../Layout/MainPane';
 import { PageAlerts } from '../PageAlert/PageAlerts';
 import { PageAlerts } from '../PageAlert/PageAlerts';
-import { ROOT_ELEM_ID as PageCommentRootElemId } from '../PageComment';
 import { PageContentFooter } from '../PageContentFooter';
 import { PageContentFooter } from '../PageContentFooter';
 import type { PageSideContentsProps } from '../PageSideContents';
 import type { PageSideContentsProps } from '../PageSideContents';
 import { UserInfo } from '../User/UserInfo';
 import { UserInfo } from '../User/UserInfo';
@@ -57,22 +56,6 @@ export const PageView = (props: Props): JSX.Element => {
 
 
   const [isCommentsLoaded, setCommentsLoaded] = useState(false);
   const [isCommentsLoaded, setCommentsLoaded] = useState(false);
 
 
-  // ***************************  Auto Scroll  ***************************
-  useEffect(() => {
-    // do nothing if hash is empty
-    const { hash } = window.location;
-    if (hash.length === 0) {
-      return;
-    }
-
-    const targetId = hash.slice(1);
-
-    const target = document.getElementById(targetId);
-    target?.scrollIntoView();
-
-  }, [isCommentsLoaded]);
-  // *******************************  end  *******************************
-
   const {
   const {
     pagePath, initialPage, rendererConfig,
     pagePath, initialPage, rendererConfig,
   } = props;
   } = props;
@@ -101,6 +84,22 @@ export const PageView = (props: Props): JSX.Element => {
     });
     });
   }, [mutateRendererOptions]);
   }, [mutateRendererOptions]);
 
 
+  // ***************************  Auto Scroll  ***************************
+  useEffect(() => {
+    // do nothing if hash is empty
+    const { hash } = window.location;
+    if (hash.length === 0) {
+      return;
+    }
+
+    const targetId = hash.slice(1);
+
+    const target = document.getElementById(targetId);
+    target?.scrollIntoView();
+
+  }, [isCommentsLoaded]);
+  // *******************************  end  *******************************
+
   const specialContents = useMemo(() => {
   const specialContents = useMemo(() => {
     if (isIdenticalPathPage) {
     if (isIdenticalPathPage) {
       return <IdenticalPathPage />;
       return <IdenticalPathPage />;