Просмотр исходного кода

fix unsaved warning processing

Yuki Takei 3 лет назад
Родитель
Сommit
1c91a871f8
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      packages/app/src/components/PageEditor.tsx

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

@@ -133,6 +133,7 @@ const PageEditor = React.memo((props: Props): JSX.Element => {
 
     try {
       await saveOrUpdate(optionsToSave, { pageId, path: currentPagePath || currentPathname, revisionId: currentRevisionId }, markdown);
+      await mutateCurrentPage();
       mutateIsEnabledUnsavedWarning(false);
     }
     catch (error) {
@@ -149,7 +150,7 @@ const PageEditor = React.memo((props: Props): JSX.Element => {
     }
 
   // eslint-disable-next-line max-len
-  }, [currentRevisionId, currentPagePath, currentPathname, grantData, isSlackEnabled, markdown, mutateIsEnabledUnsavedWarning, pageId, pageTags, slackChannels]);
+  }, [grantData, isSlackEnabled, currentPathname, slackChannels, pageTags, pageId, currentPagePath, currentRevisionId, markdown, mutateCurrentPage, mutateIsEnabledUnsavedWarning]);
 
   const saveAndReturnToViewHandler = useCallback(async(opts?: {overwriteScopesOfDescendants: boolean}) => {
     if (editorMode !== EditorMode.Editor) {
@@ -157,9 +158,8 @@ const PageEditor = React.memo((props: Props): JSX.Element => {
     }
 
     await save(opts);
-    await mutateCurrentPage();
     mutateEditorMode(EditorMode.View);
-  }, [editorMode, save, mutateCurrentPage, mutateEditorMode]);
+  }, [editorMode, save, mutateEditorMode]);
 
   const saveWithShortcut = useCallback(async() => {
     if (editorMode !== EditorMode.Editor) {