diff --git a/apps/web/src/app/(private)/datasets/preview/[datasetId]/page.tsx b/apps/web/src/app/(private)/datasets/preview/[datasetId]/page.tsx index 00c7afe36..37e702a5e 100644 --- a/apps/web/src/app/(private)/datasets/preview/[datasetId]/page.tsx +++ b/apps/web/src/app/(private)/datasets/preview/[datasetId]/page.tsx @@ -14,6 +14,9 @@ export async function generateMetadata( }, parent: ResolvingMetadata, ) { + // Wait for parent metadata to resolve to ensure auth middleware is executed + const parentMetadata = await parent + const { datasetId } = await params try { @@ -21,7 +24,7 @@ export async function generateMetadata( return buildMetatags({ title: `${dataset.name} (preview)`, - parent: await parent, + parent: parentMetadata, }) } catch (error) { if (error instanceof NotFoundError) return notFound() diff --git a/apps/web/src/app/(private)/evaluations/(evaluation)/[evaluationUuid]/layout.tsx b/apps/web/src/app/(private)/evaluations/(evaluation)/[evaluationUuid]/layout.tsx index 5abf3f689..2ba23bb79 100644 --- a/apps/web/src/app/(private)/evaluations/(evaluation)/[evaluationUuid]/layout.tsx +++ b/apps/web/src/app/(private)/evaluations/(evaluation)/[evaluationUuid]/layout.tsx @@ -14,6 +14,9 @@ export async function generateMetadata( }, parent: ResolvingMetadata, ) { + // Wait for parent metadata to resolve to ensure auth middleware is executed + const parentMetadata = await parent + const { evaluationUuid } = await params try { @@ -21,7 +24,7 @@ export async function generateMetadata( return buildMetatags({ title: evaluation.name, - parent: await parent, + parent: parentMetadata, }) } catch (error) { if (error instanceof NotFoundError) return notFound() diff --git a/apps/web/src/app/(private)/projects/[projectId]/layout.tsx b/apps/web/src/app/(private)/projects/[projectId]/layout.tsx index a7f7ddcf9..6d111b36a 100644 --- a/apps/web/src/app/(private)/projects/[projectId]/layout.tsx +++ b/apps/web/src/app/(private)/projects/[projectId]/layout.tsx @@ -15,6 +15,9 @@ export async function generateMetadata( }, parent: ResolvingMetadata, ) { + // Wait for parent metadata to resolve to ensure auth middleware is executed + const parentMetadata = await parent + const { projectId } = await params try { @@ -26,7 +29,7 @@ export async function generateMetadata( return buildMetatags({ title: project.name, - parent: await parent, + parent: parentMetadata, }) } catch (error) { if (error instanceof NotFoundError) return notFound()