|
|
@@ -3,6 +3,7 @@ import React, { useState, useEffect, useCallback } from 'react';
|
|
|
import { isPopulated, IUser } from '@growi/core';
|
|
|
import { useTranslation } from 'next-i18next';
|
|
|
import dynamic from 'next/dynamic';
|
|
|
+import { useRouter } from 'next/router';
|
|
|
import { DropdownItem } from 'reactstrap';
|
|
|
|
|
|
import { exportAsMarkdown } from '~/client/services/page-operation';
|
|
|
@@ -41,7 +42,6 @@ import { SubNavButtonsProps } from './SubNavButtons';
|
|
|
|
|
|
import AuthorInfoStyles from './AuthorInfo.module.scss';
|
|
|
import PageEditorModeManagerStyles from './PageEditorModeManager.module.scss';
|
|
|
-import { useRouter } from 'next/router';
|
|
|
|
|
|
|
|
|
const AuthorInfoSkelton = () => <Skelton additionalClass={`${AuthorInfoStyles['grw-author-info-skelton']} py-1`} />;
|
|
|
@@ -277,14 +277,14 @@ const GrowiContextualSubNavigation = (props: GrowiContextualSubNavigationProps):
|
|
|
if (currentPathname != null) {
|
|
|
router.push(currentPathname);
|
|
|
}
|
|
|
- }, []);
|
|
|
+ }, [currentPathname, router]);
|
|
|
|
|
|
const duplicateItemClickedHandler = useCallback(async(page: IPageForPageDuplicateModal) => {
|
|
|
const duplicatedHandler: OnDuplicatedFunction = (fromPath, toPath) => {
|
|
|
router.push(toPath);
|
|
|
};
|
|
|
openDuplicateModal(page, { onDuplicated: duplicatedHandler });
|
|
|
- }, [openDuplicateModal]);
|
|
|
+ }, [openDuplicateModal, router]);
|
|
|
|
|
|
const renameItemClickedHandler = useCallback(async(page: IPageToRenameWithMeta<IPageInfoForEntity>) => {
|
|
|
const renamedHandler: OnRenamedFunction = () => {
|
|
|
@@ -295,7 +295,7 @@ const GrowiContextualSubNavigation = (props: GrowiContextualSubNavigationProps):
|
|
|
reload();
|
|
|
};
|
|
|
openRenameModal(page, { onRenamed: renamedHandler });
|
|
|
- }, [openRenameModal]);
|
|
|
+ }, [openRenameModal, reload, router]);
|
|
|
|
|
|
const deleteItemClickedHandler = useCallback((pageWithMeta: IPageWithMeta) => {
|
|
|
const deletedHandler: OnDeletedFunction = (pathOrPathsToDelete, isRecursively, isCompletely) => {
|
|
|
@@ -314,7 +314,7 @@ const GrowiContextualSubNavigation = (props: GrowiContextualSubNavigationProps):
|
|
|
}
|
|
|
};
|
|
|
openDeleteModal([pageWithMeta], { onDeleted: deletedHandler });
|
|
|
- }, [openDeleteModal]);
|
|
|
+ }, [openDeleteModal, reload, router]);
|
|
|
|
|
|
const templateMenuItemClickHandler = useCallback(() => {
|
|
|
setIsPageTempleteModalShown(true);
|