|
|
@@ -64,7 +64,7 @@ const renderByInitialNode = (
|
|
|
targetPathOrId?: string,
|
|
|
onClickDuplicateMenuItem?: (pageId: string, path: string) => void,
|
|
|
onClickRenameMenuItem?: (pageId: string, revisionId: string, path: string) => void,
|
|
|
- onClickDeleteMenuItem?: (pageToDelete: IPageForPageDeleteModal | null, isAbleToDeleteCompletely: boolean) => void,
|
|
|
+ onClickDeleteMenuItem?: (pageToDelete: IPageForPageDeleteModal | null, isAbleToDeleteCompletely: boolean, mutateSiblingsOfItem: VoidFunction) => void,
|
|
|
): JSX.Element => {
|
|
|
|
|
|
return (
|
|
|
@@ -95,7 +95,6 @@ const ItemsTree: FC<ItemsTreeProps> = (props: ItemsTreeProps) => {
|
|
|
const { t } = useTranslation();
|
|
|
|
|
|
const { data: ancestorsChildrenData, error: error1 } = useSWRxPageAncestorsChildren(targetPath);
|
|
|
- const { mutate: mutateChildren } = useSWRxPageChildren(targetPathOrId);
|
|
|
const { data: rootPageData, error: error2 } = useSWRxRootPage();
|
|
|
const { open: openDuplicateModal } = usePageDuplicateModal();
|
|
|
const { open: openRenameModal } = usePageRenameModal();
|
|
|
@@ -118,24 +117,24 @@ const ItemsTree: FC<ItemsTreeProps> = (props: ItemsTreeProps) => {
|
|
|
openRenameModal(pageId, revisionId, path);
|
|
|
};
|
|
|
|
|
|
- const onDeletedHandler: OnDeletedFunction = (pathOrPathsToDelete, isRecursively, isCompletely) => {
|
|
|
- if (typeof pathOrPathsToDelete !== 'string') {
|
|
|
- return;
|
|
|
- }
|
|
|
+ const onClickDeleteMenuItem = (pageToDelete: IPageForPageDeleteModal, isAbleToDeleteCompletely, mutateSiblingsOfItem: VoidFunction) => {
|
|
|
+ const onDeletedHandler: OnDeletedFunction = (pathOrPathsToDelete, isRecursively, isCompletely) => {
|
|
|
+ if (typeof pathOrPathsToDelete !== 'string') {
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- mutateChildren();
|
|
|
+ mutateSiblingsOfItem();
|
|
|
|
|
|
- const path = pathOrPathsToDelete;
|
|
|
+ const path = pathOrPathsToDelete;
|
|
|
|
|
|
- if (isCompletely) {
|
|
|
- toastSuccess(t('deleted_pages_completely', { path }));
|
|
|
- }
|
|
|
- else {
|
|
|
- toastSuccess(t('deleted_pages', { path }));
|
|
|
- }
|
|
|
- };
|
|
|
+ if (isCompletely) {
|
|
|
+ toastSuccess(t('deleted_pages_completely', { path }));
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ toastSuccess(t('deleted_pages', { path }));
|
|
|
+ }
|
|
|
+ };
|
|
|
|
|
|
- const onClickDeleteMenuItem = (pageToDelete: IPageForPageDeleteModal, isAbleToDeleteCompletely) => {
|
|
|
openDeleteModal([pageToDelete], onDeletedHandler, isAbleToDeleteCompletely);
|
|
|
};
|
|
|
|