diff --git a/bun.lockb b/bun.lockb index c6d8be5da..c7230c2e1 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 69159d40c..9d272a846 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ }, "packageManager": "bun@1.1.18", "patchedDependencies": { - "@vercel/next@4.3.6": "patches/@vercel%2Fnext@4.3.6.patch" + "@vercel/next@4.3.15": "patches/@vercel%2Fnext@4.3.15.patch" }, "private": true, "scripts": { diff --git a/packages/gitbook/package.json b/packages/gitbook/package.json index e1be9e474..10168af54 100644 --- a/packages/gitbook/package.json +++ b/packages/gitbook/package.json @@ -16,7 +16,7 @@ "clean": "rm -rf ./.next && rm -rf ./public/~gitbook/static" }, "dependencies": { - "@gitbook/api": "0.64.1", + "@gitbook/api": "^0.66.0", "@gitbook/cache-do": "workspace:*", "@gitbook/emoji-codepoints": "workspace:*", "@gitbook/icons": "workspace:*", @@ -41,7 +41,7 @@ "katex": "^0.16.9", "mathjax": "^3.2.2", "memoizee": "^0.4.15", - "next": "^14.2.5", + "next": "14.2.15", "next-themes": "^0.2.1", "nuqs": "^1.17.4", "object-hash": "^3.0.0", diff --git a/packages/gitbook/src/app/(site)/(core)/sitemap.xml/route.ts b/packages/gitbook/src/app/(site)/(core)/sitemap.xml/route.ts index 410adfce2..43388dad4 100644 --- a/packages/gitbook/src/app/(site)/(core)/sitemap.xml/route.ts +++ b/packages/gitbook/src/app/(site)/(core)/sitemap.xml/route.ts @@ -84,10 +84,12 @@ function flattenPages( return [ ...(page.type === 'document' ? [{ page, depth }] : []), ...page.pages.flatMap((child) => - child.type === 'link' ? [] : flattenPage(child, depth + 1), + child.type === 'document' ? flattenPage(child, depth + 1) : [], ), ]; }; - return rootPags.flatMap((page) => (page.type === 'link' ? [] : flattenPage(page, 0))); + return rootPags.flatMap((page) => + page.type === 'group' || page.type === 'document' ? flattenPage(page, 0) : [], + ); } diff --git a/packages/gitbook/src/app/(space)/~gitbook/pdf/page.tsx b/packages/gitbook/src/app/(space)/~gitbook/pdf/page.tsx index e6f6a3d0a..56a2d3a34 100644 --- a/packages/gitbook/src/app/(space)/~gitbook/pdf/page.tsx +++ b/packages/gitbook/src/app/(space)/~gitbook/pdf/page.tsx @@ -315,7 +315,7 @@ function selectPages( return [ { page, depth }, ...page.pages.flatMap((child) => { - if (child.type === 'link') { + if (child.type !== 'document') { return []; } @@ -350,7 +350,7 @@ function selectPages( } const allPages = rootPages.flatMap((page) => { - if (page.type === 'link') { + if (page.type !== 'document' && page.type !== 'group') { return []; } diff --git a/packages/gitbook/src/components/DocumentView/Integration/IntegrationBlock.tsx b/packages/gitbook/src/components/DocumentView/Integration/IntegrationBlock.tsx index 5278203ef..72ede9d59 100644 --- a/packages/gitbook/src/components/DocumentView/Integration/IntegrationBlock.tsx +++ b/packages/gitbook/src/components/DocumentView/Integration/IntegrationBlock.tsx @@ -63,7 +63,7 @@ export async function IntegrationBlock(props: BlockProps (child.type === 'document' ? !child.hidden : true)); + const pages = page.pages.filter((child) => + child.type === RevisionPageType.Document ? !child.hidden : true, + ); if (!pages.length) { return null; } @@ -43,7 +45,11 @@ export async function PageBodyBlankslate(props: { /> ); - if (child.type === RevisionPageType.Link) { + if (child.type === RevisionPageType.Computed) { + throw new Error( + 'Unexpected computed page, it should have been computed in the API', + ); + } else if (child.type === RevisionPageType.Link) { const resolved = await resolveContentRef(child.target, context); if (!resolved) { return null; diff --git a/packages/gitbook/src/components/TableOfContents/PagesList.tsx b/packages/gitbook/src/components/TableOfContents/PagesList.tsx index a5f7b73b2..5545303ab 100644 --- a/packages/gitbook/src/components/TableOfContents/PagesList.tsx +++ b/packages/gitbook/src/components/TableOfContents/PagesList.tsx @@ -1,4 +1,9 @@ -import { RevisionPage, RevisionPageDocument, RevisionPageGroup } from '@gitbook/api'; +import { + RevisionPage, + RevisionPageDocument, + RevisionPageGroup, + RevisionPageType, +} from '@gitbook/api'; import { ContentRefContext } from '@/lib/references'; import { ClassValue, tcls } from '@/lib/tailwind'; @@ -19,7 +24,13 @@ export function PagesList(props: { return (