yuken 3 лет назад
Родитель
Сommit
0718bb2180
1 измененных файлов с 6 добавлено и 2 удалено
  1. 6 2
      packages/app/src/components/Navbar/GrowiContextualSubNavigation.tsx

+ 6 - 2
packages/app/src/components/Navbar/GrowiContextualSubNavigation.tsx

@@ -166,7 +166,7 @@ const GrowiContextualSubNavigation = (props: GrowiContextualSubNavigationProps):
   const { data: isAbleToShowPageEditorModeManager } = useIsAbleToShowPageEditorModeManager();
   const { data: isAbleToShowPageEditorModeManager } = useIsAbleToShowPageEditorModeManager();
   const { data: isAbleToShowPageAuthors } = useIsAbleToShowPageAuthors();
   const { data: isAbleToShowPageAuthors } = useIsAbleToShowPageAuthors();
 
 
-  const { data: tagsInfoData } = useSWRxTagsInfo(pageId);
+  const { mutate: mutateSWRTagsInfo, data: tagsInfoData } = useSWRxTagsInfo(pageId);
   const { data: tagsForEditors, mutate: mutatePageTagsForEditors, sync: syncPageTagsForEditors } = usePageTagsForEditors(pageId);
   const { data: tagsForEditors, mutate: mutatePageTagsForEditors, sync: syncPageTagsForEditors } = usePageTagsForEditors(pageId);
 
 
   const { open: openDuplicateModal } = usePageDuplicateModal();
   const { open: openDuplicateModal } = usePageDuplicateModal();
@@ -191,13 +191,17 @@ const GrowiContextualSubNavigation = (props: GrowiContextualSubNavigationProps):
       await apiPost('/tags.update', { pageId, revisionId, tags: newTags });
       await apiPost('/tags.update', { pageId, revisionId, tags: newTags });
       mutateCurrentPage();
       mutateCurrentPage();
 
 
+      // revalidate SWRTagsInfo
+      mutateSWRTagsInfo();
+      mutatePageTagsForEditors(newTags);
+
       toastSuccess('updated tags successfully');
       toastSuccess('updated tags successfully');
     }
     }
     catch (err) {
     catch (err) {
       toastError(err, 'fail to update tags');
       toastError(err, 'fail to update tags');
     }
     }
 
 
-  }, [mutateCurrentPage, pageId, revisionId]);
+  }, [mutateSWRTagsInfo, mutatePageTagsForEditors, mutateCurrentPage, pageId, revisionId]);
 
 
   const tagsUpdatedHandlerForEditMode = useCallback((newTags: string[]): void => {
   const tagsUpdatedHandlerForEditMode = useCallback((newTags: string[]): void => {
     // It will not be reflected in the DB until the page is refreshed
     // It will not be reflected in the DB until the page is refreshed