Parcourir la source

Add pageId as a dependency

Shun Miyazawa il y a 3 ans
Parent
commit
0f50157693
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  1. 2 1
      packages/app/src/pages/[[...path]].page.tsx

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

@@ -286,9 +286,10 @@ const Page: NextPageWithLayout<Props> = (props: Props) => {
   }, [props.currentPathname, router]);
 
   // initialize mutateEditingMarkdown only once per page
+  // Put pageId in the dependency array to have mutateEditingMarkdown run when the page is duplicated
   useEffect(() => {
     mutateEditingMarkdown(revisionBody);
-  }, [mutateEditingMarkdown, revisionBody]);
+  }, [mutateEditingMarkdown, revisionBody, pageId]);
 
   const title = generateCustomTitleForPage(props, pagePath);