Ver Fonte

escape error with optional chain

yuken há 3 anos atrás
pai
commit
1d633138f7
1 ficheiros alterados com 2 adições e 2 exclusões
  1. 2 2
      packages/app/src/components/PageEditor.tsx

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

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