|
@@ -18,7 +18,7 @@ import {
|
|
|
} from '~/stores/modal';
|
|
} from '~/stores/modal';
|
|
|
import { useCurrentPagePath, usePageInfoTermManager, useSWRMUTxCurrentPage } from '~/stores/page';
|
|
import { useCurrentPagePath, usePageInfoTermManager, useSWRMUTxCurrentPage } from '~/stores/page';
|
|
|
import {
|
|
import {
|
|
|
- useSWRxPageAncestorsChildren, useSWRxRootPage, useDescendantsPageListForCurrentPathTermManager, mutatePageTree,
|
|
|
|
|
|
|
+ useSWRxPageAncestorsChildren, useSWRxRootPage, mutatePageTree, mutateDescendantsPageListForCurrentPath,
|
|
|
} from '~/stores/page-listing';
|
|
} from '~/stores/page-listing';
|
|
|
import { useFullTextSearchTermManager } from '~/stores/search';
|
|
import { useFullTextSearchTermManager } from '~/stores/search';
|
|
|
import { usePageTreeDescCountMap, useSidebarScrollerRef } from '~/stores/ui';
|
|
import { usePageTreeDescCountMap, useSidebarScrollerRef } from '~/stores/ui';
|
|
@@ -119,7 +119,6 @@ const ItemsTree = (props: ItemsTreeProps): JSX.Element => {
|
|
|
// for mutation
|
|
// for mutation
|
|
|
const { trigger: mutateCurrentPage } = useSWRMUTxCurrentPage();
|
|
const { trigger: mutateCurrentPage } = useSWRMUTxCurrentPage();
|
|
|
const { advance: advanceFts } = useFullTextSearchTermManager();
|
|
const { advance: advanceFts } = useFullTextSearchTermManager();
|
|
|
- const { advance: advanceDpl } = useDescendantsPageListForCurrentPathTermManager();
|
|
|
|
|
const { advance: advancePi } = usePageInfoTermManager();
|
|
const { advance: advancePi } = usePageInfoTermManager();
|
|
|
|
|
|
|
|
const [isInitialScrollCompleted, setIsInitialScrollCompleted] = useState(false);
|
|
const [isInitialScrollCompleted, setIsInitialScrollCompleted] = useState(false);
|
|
@@ -152,12 +151,12 @@ const ItemsTree = (props: ItemsTreeProps): JSX.Element => {
|
|
|
const onRenamed = useCallback((fromPath: string | undefined, toPath: string) => {
|
|
const onRenamed = useCallback((fromPath: string | undefined, toPath: string) => {
|
|
|
mutatePageTree();
|
|
mutatePageTree();
|
|
|
advanceFts();
|
|
advanceFts();
|
|
|
- advanceDpl();
|
|
|
|
|
|
|
+ mutateDescendantsPageListForCurrentPath();
|
|
|
|
|
|
|
|
if (currentPagePath === fromPath || currentPagePath === toPath) {
|
|
if (currentPagePath === fromPath || currentPagePath === toPath) {
|
|
|
mutateCurrentPage();
|
|
mutateCurrentPage();
|
|
|
}
|
|
}
|
|
|
- }, [advanceDpl, advanceFts, currentPagePath, mutateCurrentPage]);
|
|
|
|
|
|
|
+ }, [advanceFts, currentPagePath, mutateCurrentPage]);
|
|
|
|
|
|
|
|
const onClickDuplicateMenuItem = useCallback((pageToDuplicate: IPageForPageDuplicateModal) => {
|
|
const onClickDuplicateMenuItem = useCallback((pageToDuplicate: IPageForPageDuplicateModal) => {
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -166,11 +165,11 @@ const ItemsTree = (props: ItemsTreeProps): JSX.Element => {
|
|
|
|
|
|
|
|
mutatePageTree();
|
|
mutatePageTree();
|
|
|
advanceFts();
|
|
advanceFts();
|
|
|
- advanceDpl();
|
|
|
|
|
|
|
+ mutateDescendantsPageListForCurrentPath();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
openDuplicateModal(pageToDuplicate, { onDuplicated: duplicatedHandler });
|
|
openDuplicateModal(pageToDuplicate, { onDuplicated: duplicatedHandler });
|
|
|
- }, [advanceDpl, advanceFts, openDuplicateModal, t]);
|
|
|
|
|
|
|
+ }, [advanceFts, openDuplicateModal, t]);
|
|
|
|
|
|
|
|
const onClickDeleteMenuItem = useCallback((pageToDelete: IPageToDeleteWithMeta) => {
|
|
const onClickDeleteMenuItem = useCallback((pageToDelete: IPageToDeleteWithMeta) => {
|
|
|
const onDeletedHandler: OnDeletedFunction = (pathOrPathsToDelete, isRecursively, isCompletely) => {
|
|
const onDeletedHandler: OnDeletedFunction = (pathOrPathsToDelete, isRecursively, isCompletely) => {
|
|
@@ -189,7 +188,7 @@ const ItemsTree = (props: ItemsTreeProps): JSX.Element => {
|
|
|
|
|
|
|
|
mutatePageTree();
|
|
mutatePageTree();
|
|
|
advanceFts();
|
|
advanceFts();
|
|
|
- advanceDpl();
|
|
|
|
|
|
|
+ mutateDescendantsPageListForCurrentPath();
|
|
|
advancePi();
|
|
advancePi();
|
|
|
|
|
|
|
|
if (currentPagePath === pathOrPathsToDelete) {
|
|
if (currentPagePath === pathOrPathsToDelete) {
|
|
@@ -199,7 +198,7 @@ const ItemsTree = (props: ItemsTreeProps): JSX.Element => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
openDeleteModal([pageToDelete], { onDeleted: onDeletedHandler });
|
|
openDeleteModal([pageToDelete], { onDeleted: onDeletedHandler });
|
|
|
- }, [advanceDpl, advanceFts, advancePi, currentPagePath, mutateCurrentPage, openDeleteModal, router, t]);
|
|
|
|
|
|
|
+ }, [advanceFts, advancePi, currentPagePath, mutateCurrentPage, openDeleteModal, router, t]);
|
|
|
|
|
|
|
|
// *************************** Scroll on init ***************************
|
|
// *************************** Scroll on init ***************************
|
|
|
const scrollOnInit = useCallback(() => {
|
|
const scrollOnInit = useCallback(() => {
|