Remove MetadataContext type and construct isStaticMetadataRouteFile inside resolveMetadata#90305
Remove MetadataContext type and construct isStaticMetadataRouteFile inside resolveMetadata#90305gnoff wants to merge 1 commit intojstory/next-invariantsfrom
Conversation
Failing test suitesCommit: 8e9f650 | About building and testing Next.js
Expand output● next-invariants › should have a client component for every invariant key and no extras ● next-invariants › should SSR the replaced values in client components ● next-invariants › should SSR the replaced values in server components ● next-invariants › should hydrate client components in the browser ● next-invariants › should read invariants from the runtime global in external packages ● next-invariants › should not have any NEXT_INVARIANTS references in client bundles ● next-invariants › should not have any NEXT_INVARIANTS references in server bundles
Expand output● app dir - basic › should have correct cache-control for SSR routes ● app dir - basic › should contain framework.json ● app dir - basic › outputs correct build-diagnostics.json ● app dir - basic › should have correct preferredRegion values in manifest ● app dir - basic › should work for catch-all edge page ● app dir - basic › should return normalized dynamic route params for catch-all edge page ● app dir - basic › should have correct searchParams and params (server) ● app dir - basic › should have correct searchParams and params (client) ● app dir - basic › should expose app source page on window.next.__internal_src_page for /dashboard ● app dir - basic › should expose app source page on window.next.__internal_src_page for /dynamic/category-1/id-2 ● app dir - basic › should expose app source page on window.next.__internal_src_page for /dashboard/another ● app dir - basic › should update window.next.__internal_src_page on app router transitions ● app dir - basic › should successfully detect app route during prefetch ● app dir - basic › should encode chunk path correctly ● app dir - basic › should match redirects in pages correctly $path ● app dir - basic › should match redirects in pages correctly $path ● app dir - basic › should match redirects in pages correctly $path ● app dir - basic › should match redirects in pages correctly $path ● app dir - basic › should match redirects in pages correctly $path ● app dir - basic › should match redirects in pages correctly $path ● app dir - basic › should not apply client router filter on shallow ● app dir - basic › should not share edge workers ● app dir - basic › should generate build traces correctly ● app dir - basic › should use text/x-component for flight ● app dir - basic › should use text/x-component for flight with edge runtime ● app dir - basic › should return the ● app dir - basic › should return the ● app dir - basic › should pass props from getServerSideProps in root layout ● app dir - basic › should serve from pages ● app dir - basic › should serve dynamic route from pages ● app dir - basic › should serve from public ● app dir - basic › should serve from app ● app dir - basic › should ensure the suffix is at the end of the stream ● app dir - basic › should serve /index as separate page ● app dir - basic › should serve polyfills for browsers that do not support modules ● app dir - basic › should handle css imports in next/dynamic correctly ● app dir - basic › should include layouts when no direct parent layout ● app dir - basic › should not include parent when not in parent directory with route in directory ● app dir - basic › should use new root layout when provided ● app dir - basic › should not create new root layout when nested (optional) ● app dir - basic › should include parent document when no direct parent layout ● app dir - basic › should not include parent when not in parent directory ● app dir - basic › should serve nested parent ● app dir - basic › should serve dynamic parameter ● app dir - basic › should serve page as a segment name correctly ● app dir - basic › should include document html and body ● app dir - basic › should not serve when layout is provided but no folder index ● app dir - basic › should match partial parameters ● app dir - basic › rewrites › should support rewrites on initial load ● app dir - basic › rewrites › should support rewrites on client-side navigation from pages to app with existing pages path ● app dir - basic › rewrites › should support rewrites on client-side navigation ● app dir - basic › should not rerender layout when navigating between routes in the same layout ● app dir - basic › should handle hash in initial url ● app dir - basic › › should hard push ● app dir - basic › › should hard replace ● app dir - basic › › should soft push ● app dir - basic › › should soft replace ● app dir - basic › › should be soft for back navigation ● app dir - basic › › should be soft for forward navigation ● app dir - basic › › should allow linking from app page to pages page ● app dir - basic › › should navigate to pages dynamic route from pages page if it overlaps with an app page ● app dir - basic › › should push to external url ● app dir - basic › › should replace to external url ● app dir - basic › server components › should not serve .server.js as a path ● app dir - basic › server components › should not serve .client.js as a path ● app dir - basic › server components › should serve shared component ● app dir - basic › server components › dynamic routes › should only pass params that apply to the layout ● app dir - basic › server components › catch-all routes › should handle optional segments ● app dir - basic › server components › catch-all routes › should handle optional segments root ● app dir - basic › server components › catch-all routes › should handle optional catch-all segments link ● app dir - basic › server components › catch-all routes › should handle required segments ● app dir - basic › server components › catch-all routes › should handle required segments root as not found ● app dir - basic › server components › catch-all routes › should handle catch-all segments link ● app dir - basic › server components › should serve client component › should serve server-side ● app dir - basic › server components › should serve client component › should serve client-side ● app dir - basic › server components › should include client component layout with server component route › should include it server-side ● app dir - basic › server components › should include client component layout with server component route › should include it client-side ● app dir - basic › server components › Loading › should render loading.js in initial html for slow page ● app dir - basic › server components › Loading › should render loading.js in browser for slow page ● app dir - basic › server components › Loading › should render loading.js in initial html for slow layout ● app dir - basic › server components › Loading › should render loading.js in browser for slow layout ● app dir - basic › server components › Loading › should render loading.js in initial html for slow layout and page ● app dir - basic › server components › Loading › should render loading.js in browser for slow layout and page ● app dir - basic › server components › middleware › should strip internal query parameters from requests to middleware for rewrite ● app dir - basic › server components › middleware › should strip internal query parameters from requests to middleware for redirect ● app dir - basic › server components › next/router › should support router.back and router.forward ● app dir - basic › server components › client components › should have consistent query and params handling ● app dir - basic › searchParams prop › client component › should have the correct search params ● app dir - basic › searchParams prop › client component › should have the correct search params on rewrite ● app dir - basic › searchParams prop › client component › should have the correct search params on middleware rewrite ● app dir - basic › searchParams prop › server component › should have the correct search params ● app dir - basic › searchParams prop › server component › should have the correct search params on rewrite ● app dir - basic › searchParams prop › server component › should have the correct search params on middleware rewrite ● app dir - basic › template component › should render the template that holds state in a client component and reset on navigation ● app dir - basic › template component › should render the template that is a server component and rerender on navigation ● app dir - basic › known bugs › should support React cache › server component ● app dir - basic › known bugs › should support React cache › server component client-navigation ● app dir - basic › known bugs › should support React cache › client component ● app dir - basic › known bugs › should support React cache › client component client-navigation ● app dir - basic › known bugs › should support React cache › middleware overriding headers ● app dir - basic › known bugs › should support React fetch instrumentation › server component ● app dir - basic › known bugs › should support React fetch instrumentation › server component client-navigation ● app dir - basic › known bugs › should support React fetch instrumentation › client component ● app dir - basic › known bugs › should support React fetch instrumentation › client component client-navigation ● app dir - basic › known bugs › should not share flight data between requests ● app dir - basic › known bugs › should handle router.refresh without resetting state ● app dir - basic › known bugs › should handle as on next/link ● app dir - basic › known bugs › should handle next/link back to initially loaded page ● app dir - basic › known bugs › should not do additional pushState when already on the page ● app dir - basic › next/script › should support next/script and render in correct order ● app dir - basic › next/script › should pass on extra props for beforeInteractive scripts with a src prop ● app dir - basic › next/script › should pass on extra props for beforeInteractive scripts without a src prop ● app dir - basic › next/script › should insert preload tags for beforeInteractive and afterInteractive scripts ● app dir - basic › next/script › should load stylesheets for next/scripts ● app dir - basic › next/script › should pass ● app dir - basic › next/script › should pass manual ● app dir - basic › next/script › should pass manual ● app dir - basic › next/script › should pass nonce when using next/font ● app dir - basic › data fetch with response over 16KB with chunked encoding › should load page when fetching a large amount of data ● app dir - basic › bootstrap scripts › should only bootstrap with one script, prinitializing the rest ● app dir - basic › bootstrap scripts › should successfully bootstrap even when using CSP |
d16ea80 to
84c944c
Compare
…nside resolveMetadata
MetadataContext was a single-field object ({ isStaticMetadataRouteFile: boolean }) that was threaded from createMetadataComponents through the entire metadata resolution chain — six layers of function calls deep — even though every external caller always passed false. The only place that ever set it to true was mergeStaticMetadata, internally.
Instead of threading a constant through the closure and across the call stack, resolveMetadata now constructs the default false value internally. The field is replaced with a plain boolean parameter that only appears in functions that actually distinguish between static and non-static metadata routes.
Deletes metadata-context.tsx and the MetadataContext type.
1c15016 to
8e9f650
Compare
Stats from current PR🟢 1 improvement
📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
⚡ Dev Server
📦 Dev Server (Webpack) (Legacy)📦 Dev Server (Webpack)
⚡ Production Builds
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes⚡ TurbopackClient Main Bundles: **399 kB** → **399 kB** ✅ -5 B80 files with content-based hashes (individual files not comparable between builds) Server Middleware
Build DetailsBuild Manifests
📦 WebpackClient Main Bundles
Polyfills
Pages
Server Edge SSR
Middleware
Build DetailsBuild Manifests
Build Cache
🔄 Shared (bundler-independent)Runtimes
📝 Changed Files (9 files)Files with changes:
View diffsapp-page-exp..ntime.dev.jsfailed to diffapp-page-exp..time.prod.jsfailed to diffapp-page-tur..ntime.dev.jsfailed to diffapp-page-tur..time.prod.jsfailed to diffapp-page-tur..ntime.dev.jsfailed to diffapp-page-tur..time.prod.jsfailed to diffapp-page.runtime.dev.jsfailed to diffapp-page.runtime.prod.jsDiff too large to display server.runtime.prod.jsDiff too large to display |
Stacked on #90270
MetadataContext was a single-field object ({ isStaticMetadataRouteFile: boolean }) that was threaded from createMetadataComponents through the entire metadata resolution chain — six layers of function calls deep — even though every external caller always passed false. The only place that ever set it to true was mergeStaticMetadata, internally.
Instead of threading a constant through the closure and across the call stack, resolveMetadata now constructs the default false value internally. The field is replaced with a plain boolean parameter that only appears in functions that actually distinguish between static and non-static metadata routes.
Deletes metadata-context.tsx and the MetadataContext type.