Shun Miyazawa 2 년 전
부모
커밋
90acbbc0a8
1개의 변경된 파일2개의 추가작업 그리고 10개의 파일을 삭제
  1. 2 10
      apps/app/src/components/PageEditor.tsx

+ 2 - 10
apps/app/src/components/PageEditor.tsx

@@ -83,7 +83,7 @@ const PageEditor = React.memo((): JSX.Element => {
   const { data: currentPathname } = useCurrentPathname();
   const { data: currentPage } = useSWRxCurrentPage();
   const { trigger: mutateCurrentPage } = useSWRMUTxCurrentPage();
-  const { data: grantData } = useSelectedGrant();
+  const { data: grantData, mutate: mutateGrant } = useSelectedGrant();
   const { data: pageTags, sync: syncTagsInfoForEditor } = usePageTagsForEditors(pageId);
   const { mutate: mutateTagsInfo } = useSWRxTagsInfo(pageId);
   const { data: editingMarkdown, mutate: mutateEditingMarkdown } = useEditingMarkdown();
@@ -110,14 +110,7 @@ const PageEditor = React.memo((): JSX.Element => {
 
   const updateStateAfterSave = useUpdateStateAfterSave(pageId, { supressEditingMarkdownMutation: true });
 
-  const [createdPageRevisionIdWithAttachment, setCreatedPageRevisionIdWithAttachment] = useState('');
-
-  // Reset on page transition
-  useEffect(() => {
-    setCreatedPageRevisionIdWithAttachment('');
-  }, [router]);
-
-  const currentRevisionId = currentPage?.revision?._id ?? createdPageRevisionIdWithAttachment;
+  const currentRevisionId = currentPage?.revision?._id;
 
   const initialValue = useMemo(() => {
     if (!isNotFound) {
@@ -336,7 +329,6 @@ const PageEditor = React.memo((): JSX.Element => {
         mutateIsLatestRevision(true);
         await mutateCurrentPageId(res.page._id);
         await mutateCurrentPage();
-        setCreatedPageRevisionIdWithAttachment(res.page.revision);
       }
     }
     catch (e) {