|
|
@@ -27,7 +27,6 @@ import {
|
|
|
import {
|
|
|
useSWRMUTxCurrentPage, useSWRxTagsInfo, useCurrentPageId, useIsNotFound, useTemplateTagData, useSWRxPageInfo,
|
|
|
} from '~/stores/page';
|
|
|
-import { mutatePageTree } from '~/stores/page-listing';
|
|
|
import {
|
|
|
EditorMode, useDrawerMode, useEditorMode, useIsAbleToShowPageManagement, useIsAbleToShowTagLabel,
|
|
|
useIsAbleToChangeEditorMode, useIsAbleToShowPageAuthors,
|
|
|
@@ -284,6 +283,12 @@ const GrowiContextualSubNavigation = (props: GrowiContextualSubNavigationProps):
|
|
|
return;
|
|
|
}, [mutatePageTagsForEditors]);
|
|
|
|
|
|
+ const reload = useCallback(() => {
|
|
|
+ if (currentPathname != null) {
|
|
|
+ router.push(currentPathname);
|
|
|
+ }
|
|
|
+ }, [currentPathname, router]);
|
|
|
+
|
|
|
const duplicateItemClickedHandler = useCallback(async(page: IPageForPageDuplicateModal) => {
|
|
|
const duplicatedHandler: OnDuplicatedFunction = (fromPath, toPath) => {
|
|
|
router.push(toPath);
|
|
|
@@ -293,12 +298,10 @@ const GrowiContextualSubNavigation = (props: GrowiContextualSubNavigationProps):
|
|
|
|
|
|
const renameItemClickedHandler = useCallback(async(page: IPageToRenameWithMeta<IPageInfoForEntity>) => {
|
|
|
const renamedHandler: OnRenamedFunction = () => {
|
|
|
- mutateCurrentPage();
|
|
|
- mutatePageInfo();
|
|
|
- mutatePageTree();
|
|
|
+ reload();
|
|
|
};
|
|
|
openRenameModal(page, { onRenamed: renamedHandler });
|
|
|
- }, [mutateCurrentPage, mutatePageInfo, openRenameModal]);
|
|
|
+ }, [openRenameModal, reload]);
|
|
|
|
|
|
const deleteItemClickedHandler = useCallback((pageWithMeta: IPageWithMeta) => {
|
|
|
const deletedHandler: OnDeletedFunction = (pathOrPathsToDelete, isRecursively, isCompletely) => {
|
|
|
@@ -318,7 +321,6 @@ const GrowiContextualSubNavigation = (props: GrowiContextualSubNavigationProps):
|
|
|
|
|
|
mutateCurrentPage();
|
|
|
mutatePageInfo();
|
|
|
- mutatePageTree();
|
|
|
};
|
|
|
openDeleteModal([pageWithMeta], { onDeleted: deletedHandler });
|
|
|
}, [currentPathname, mutateCurrentPage, openDeleteModal, router, mutatePageInfo]);
|