瀏覽代碼

Add pageId as a dependency

Shun Miyazawa 3 年之前
父節點
當前提交
0f50157693
共有 1 個文件被更改,包括 2 次插入1 次删除
  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);