diff --git a/packages/kit/src/exports/public.d.ts b/packages/kit/src/exports/public.d.ts index 1e26cbc99dc0..34f2a33d6890 100644 --- a/packages/kit/src/exports/public.d.ts +++ b/packages/kit/src/exports/public.d.ts @@ -697,7 +697,7 @@ export type Handle = (input: { */ export type HandlePageData = (input: { event: RequestEvent; - pageData: Record; + pageData: Record[]; }) => MaybePromise; /** diff --git a/packages/kit/src/runtime/server/page/index.js b/packages/kit/src/runtime/server/page/index.js index 24a34b4d6916..ec33d614e097 100644 --- a/packages/kit/src/runtime/server/page/index.js +++ b/packages/kit/src/runtime/server/page/index.js @@ -299,7 +299,7 @@ export async function render_page(event, page, options, manifest, state, resolve const hookResponse = await options.hooks.handlePageData({ event, - pageData: compact(branch).map((b) => b.data) + pageData: compact(branch.map((b) => b?.data)) }); if (hookResponse) return hookResponse; diff --git a/packages/kit/types/index.d.ts b/packages/kit/types/index.d.ts index 6b06d12bc2d4..6d0847e6c6cc 100644 --- a/packages/kit/types/index.d.ts +++ b/packages/kit/types/index.d.ts @@ -679,7 +679,7 @@ declare module '@sveltejs/kit' { */ export type HandlePageData = (input: { event: RequestEvent; - pageData: Record; + pageData: Record[]; }) => MaybePromise; /**