|
|
@@ -7,6 +7,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
|
|
|
import { usePageDeleteModal, usePutBackPageModal } from '~/stores/modal';
|
|
|
import { useSWRxPageInfo, useSWRxCurrentPage, useIsTrashPage } from '~/stores/page';
|
|
|
+import { useRedirectFrom } from '~/stores/page-redirect';
|
|
|
import { useIsAbleToShowTrashPageManagementButtons } from '~/stores/ui';
|
|
|
|
|
|
const onDeletedHandler = (pathOrPathsToDelete) => {
|
|
|
@@ -31,6 +32,7 @@ export const TrashPageAlert = (): JSX.Element => {
|
|
|
|
|
|
const { open: openDeleteModal } = usePageDeleteModal();
|
|
|
const { open: openPutBackPageModal } = usePutBackPageModal();
|
|
|
+ const { unlink } = useRedirectFrom();
|
|
|
|
|
|
|
|
|
const deleteUser = pageData?.deleteUser;
|
|
|
@@ -45,10 +47,11 @@ export const TrashPageAlert = (): JSX.Element => {
|
|
|
const putBackedHandler = () => {
|
|
|
// Do not use "router.push(`/${pageId}`)" to avoid `Error: Invariant: attempted to hard navigate to the same URL`
|
|
|
// See: https://github.com/weseek/growi/pull/7054
|
|
|
+ unlink();
|
|
|
router.reload();
|
|
|
};
|
|
|
openPutBackPageModal({ pageId, path: pagePath }, { onPutBacked: putBackedHandler });
|
|
|
- }, [openPutBackPageModal, pageId, pagePath, router]);
|
|
|
+ }, [openPutBackPageModal, pageId, pagePath, router, unlink]);
|
|
|
|
|
|
const openPageDeleteModalHandler = useCallback(() => {
|
|
|
if (pageId === undefined || revisionId === undefined || pagePath === undefined) {
|