mirror of
https://github.com/docmost/docmost.git
synced 2026-08-26 00:07:04 +08:00
fix: display subpages correctly on first load (#2423)
This commit is contained in:
@@ -13,14 +13,17 @@ import {
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { sortPositionKeys } from "@/features/page/tree/utils/utils";
|
import { sortPositionKeys } from "@/features/page/tree/utils/utils";
|
||||||
import { useSharedPageSubpages } from "@/features/share/hooks/use-shared-page-subpages";
|
import { useSharedPageSubpages } from "@/features/share/hooks/use-shared-page-subpages";
|
||||||
|
import { extractPageSlugId } from "@/lib";
|
||||||
|
|
||||||
export default function SubpagesView(props: NodeViewProps) {
|
export default function SubpagesView(props: NodeViewProps) {
|
||||||
const { editor } = props;
|
const { editor } = props;
|
||||||
const { spaceSlug, shareId } = useParams();
|
const { spaceSlug, shareId, pageSlug } = useParams();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const currentPageId = editor.storage.pageId;
|
const storagePageId = editor.storage.pageId;
|
||||||
|
const routePageId = extractPageSlugId(pageSlug);
|
||||||
|
const currentPageId = storagePageId ?? routePageId;
|
||||||
|
|
||||||
// Get subpages from shared tree if we're in a shared context
|
// Get subpages from shared tree if we're in a shared context
|
||||||
const sharedSubpages = useSharedPageSubpages(currentPageId);
|
const sharedSubpages = useSharedPageSubpages(currentPageId);
|
||||||
|
|||||||
Reference in New Issue
Block a user