Procházet zdrojové kódy

fix initialization order

Yuki Takei před 3 roky
rodič
revize
43404d7321
1 změnil soubory, kde provedl 4 přidání a 3 odebrání
  1. 4 3
      packages/app/src/pages/[[...path]].page.tsx

+ 4 - 3
packages/app/src/pages/[[...path]].page.tsx

@@ -233,9 +233,6 @@ const GrowiPage: NextPage<Props> = (props: Props) => {
 
 
   const { pageWithMeta, userUISettings } = props;
   const { pageWithMeta, userUISettings } = props;
 
 
-  useSWRxCurrentPage(undefined, pageWithMeta?.data ?? null); // store initial data
-  useEditingMarkdown(pageWithMeta?.data.revision?.body ?? '');
-
   const pageId = pageWithMeta?.data._id;
   const pageId = pageWithMeta?.data._id;
   const pagePath = pageWithMeta?.data.path ?? (!_isPermalink(props.currentPathname) ? props.currentPathname : undefined);
   const pagePath = pageWithMeta?.data.path ?? (!_isPermalink(props.currentPathname) ? props.currentPathname : undefined);
 
 
@@ -245,6 +242,10 @@ const GrowiPage: NextPage<Props> = (props: Props) => {
   useCurrentPagePath(pagePath);
   useCurrentPagePath(pagePath);
   useCurrentPathname(props.currentPathname);
   useCurrentPathname(props.currentPathname);
   useIsTrashPage(pagePath != null && _isTrashPage(pagePath));
   useIsTrashPage(pagePath != null && _isTrashPage(pagePath));
+
+  useSWRxCurrentPage(undefined, pageWithMeta?.data ?? null); // store initial data
+  useEditingMarkdown(pageWithMeta?.data.revision?.body ?? '');
+
   const { data: layoutSetting } = useLayoutSetting({ isContainerFluid: props.isContainerFluid });
   const { data: layoutSetting } = useLayoutSetting({ isContainerFluid: props.isContainerFluid });
   const { data: dataPageInfo } = useSWRxPageInfo(pageId);
   const { data: dataPageInfo } = useSWRxPageInfo(pageId);