|
@@ -9,6 +9,8 @@ import React, {
|
|
|
type JSX,
|
|
type JSX,
|
|
|
} from 'react';
|
|
} from 'react';
|
|
|
|
|
|
|
|
|
|
+import { addTrailingSlash } from '@growi/core/dist/utils/path-utils';
|
|
|
|
|
+
|
|
|
import { useSWRxPageChildren } from '~/stores/page-listing';
|
|
import { useSWRxPageChildren } from '~/stores/page-listing';
|
|
|
import { usePageTreeDescCountMap } from '~/stores/ui';
|
|
import { usePageTreeDescCountMap } from '~/stores/ui';
|
|
|
|
|
|
|
@@ -88,9 +90,10 @@ export const TreeItemLayout = (props: TreeItemLayoutProps): JSX.Element => {
|
|
|
setIsOpen(!isOpen);
|
|
setIsOpen(!isOpen);
|
|
|
}, [isOpen]);
|
|
}, [isOpen]);
|
|
|
|
|
|
|
|
- // didMount
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
- const isPathToTarget = page.path != null && targetPath.startsWith(page.path) && targetPath !== page.path; // Target Page does not need to be opened
|
|
|
|
|
|
|
+ const isPathToTarget = page.path != null
|
|
|
|
|
+ && targetPath.startsWith(addTrailingSlash(page.path))
|
|
|
|
|
+ && targetPath !== page.path; // Target Page does not need to be opened
|
|
|
if (isPathToTarget) setIsOpen(true);
|
|
if (isPathToTarget) setIsOpen(true);
|
|
|
}, [targetPath, page.path]);
|
|
}, [targetPath, page.path]);
|
|
|
|
|
|