Shun Miyazawa 2 лет назад
Родитель
Сommit
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) {