Skip to content

Commit

Permalink
[dynamicIO] detect metadata boundaries in dev using server component …
Browse files Browse the repository at this point in the history
…stacks (#71666)

Component stacks in dev are sourcemapped and currently there is a bug
that prevents the right function name from showing up which interrupts
our ability to detect incomplete metadata in dev
  • Loading branch information
gnoff authored Oct 22, 2024
1 parent cfa003c commit a7a7b19
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/next/src/lib/metadata/metadata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ import type {
import { isNotFoundError } from '../../client/components/not-found'
import type { MetadataContext } from './types/resolvers'
import type { WorkStore } from '../../server/app-render/work-async-storage.external'
import {
METADATA_BOUNDARY_NAME,
VIEWPORT_BOUNDARY_NAME,
} from './metadata-constants'

// Use a promise to share the status of the metadata resolving,
// returning two components `MetadataTree` and `MetadataOutlet`
Expand Down Expand Up @@ -110,6 +114,7 @@ export function createMetadataComponents({
return null
}
}
Viewport.displayName = VIEWPORT_BOUNDARY_NAME

async function metadata() {
return getResolvedMetadata(
Expand Down Expand Up @@ -146,6 +151,7 @@ export function createMetadataComponents({
return null
}
}
Metadata.displayName = METADATA_BOUNDARY_NAME

async function getMetadataAndViewportReady(): Promise<void> {
await viewport()
Expand Down
2 changes: 2 additions & 0 deletions packages/next/src/server/app-render/create-component-tree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { StaticGenBailoutError } from '../../client/components/static-generation
import type { LoadingModuleData } from '../../shared/lib/app-router-context.shared-runtime'
import type { Params } from '../request/params'
import { workUnitAsyncStorage } from './work-unit-async-storage.external'
import { OUTLET_BOUNDARY_NAME } from '../../lib/metadata/metadata-constants'

/**
* Use the provided loader tree to create the React Component tree.
Expand Down Expand Up @@ -736,3 +737,4 @@ async function MetadataOutlet({
}
return null
}
MetadataOutlet.displayName = OUTLET_BOUNDARY_NAME

0 comments on commit a7a7b19

Please sign in to comment.