Browse Source

escape error with optional chain

yuken 3 năm trước cách đây
mục cha
commit
1d633138f7

+ 2 - 2
packages/app/src/components/PageEditor.tsx

@@ -108,9 +108,9 @@ const PageEditor = (props: Props): JSX.Element => {
 
 
   useEffect(() => {
   useEffect(() => {
     if (currentPage != null) {
     if (currentPage != null) {
-      setMarkdown(currentPage.revision.body);
+      setMarkdown(currentPage.revision?.body);
     }
     }
-  }, [currentPage, currentPage?.revision.body]);
+  }, [currentPage, currentPage?.revision?.body]);
 
 
 
 
   const editorRef = useRef<EditorRef>(null);
   const editorRef = useRef<EditorRef>(null);