Add unstable parallel metadata selectors - #97449
Draft
gnoff wants to merge 1 commit into
Draft
Conversation
Contributor
Tests PassedCommit: 877f0e8 |
Contributor
Stats from current PR🔴 3 regressions, 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
Server Middleware
Build DetailsBuild Manifests
Build Cache
📦 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.jsDiff too large to display app-page-tur..ntime.dev.jsfailed to diffapp-page-tur..time.prod.jsDiff too large to display app-page-tur..ntime.dev.jsDiff too large to display app-page-tur..time.prod.jsDiff too large to display app-page.runtime.dev.jsDiff too large to display app-page.runtime.prod.jsDiff too large to display server.runtime.prod.jsDiff too large to display 📎 Tarball URLCommit: 877f0e8 |
## Summary Add `unstable_selectMetadata` and `unstable_selectViewport` layout exports so applications can override the built-in selection at the next parallel-route fork. Each selector receives slot-keyed handles containing a resolution status and postprocessed value. Returning a handle or its resolved result preserves that branch, while returning a rewritten selected value creates a resolved selection for higher forks. Track metadata and viewport selection independently, apply the closest selector above each fork, and carry nested selections upward before resolving a new fork. Continue using the built-in structural heuristic when no selector is defined and preserve eager metadata and viewport generation. Keep branch outcomes separate from head selection. Navigation and regular errors remain attached to their slot outlets, while selector failures replay through every descendant outlet so whichever slot renders reaches its normal boundary. Convention metadata and viewport are resolved against their independently selected branch paths. Export the new selection types, validate selectors as layout-only server APIs in both route type generators and the RSC transform, and add coverage for direct handles, rewritten values, ancestor and nested selectors, independent metadata and viewport choices, navigation status, and selector error replay. ## Verification - `pnpm --filter=next types` - `pnpm exec eslint --config eslint.config.mjs packages/next/src/build/webpack/plugins/next-types-plugin/index.ts packages/next/src/lib/metadata/metadata-parallel.tsx packages/next/src/lib/metadata/metadata-resolution-primitives.ts packages/next/src/lib/metadata/resolve-metadata-parallel.ts packages/next/src/lib/metadata/types/metadata-interface.ts packages/next/src/server/lib/router-utils/typegen.ts packages/next/src/server/typescript/constant.ts packages/next/src/types.ts test/e2e/app-dir/metadata-streaming-parallel-routes` - `cargo fmt --all -- --check` - `cargo test -p next-custom-transforms --test errors react_server_components_errors` - `pnpm test-dev-turbo test/e2e/app-dir/metadata-streaming-parallel-routes/metadata-streaming-parallel-routes.test.ts` - `pnpm test-start-turbo test/e2e/app-dir/metadata-streaming-parallel-routes/metadata-streaming-parallel-routes.test.ts` - `pnpm test-start-webpack test/e2e/app-dir/metadata-streaming-parallel-routes/metadata-streaming-parallel-routes.test.ts` <!-- NEXT_JS_LLM -->
gnoff
force-pushed
the
jstory/unstable-select-metadata
branch
from
August 17, 2026 06:13
aabf92e to
877f0e8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
unstable_selectMetadataandunstable_selectViewportlayout exports so applications can override the built-in selection at the next parallel-route fork. Each selector receives slot-keyed handles containing a resolution status and postprocessed value. Returning a handle or its resolved result preserves that branch, while returning a rewritten selected value creates a resolved selection for higher forks.Track metadata and viewport selection independently, apply the closest selector above each fork, and carry nested selections upward before resolving a new fork. Continue using the built-in structural heuristic when no selector is defined and preserve eager metadata and viewport generation.
Keep branch outcomes separate from head selection. Navigation and regular errors remain attached to their slot outlets, while selector failures replay through every descendant outlet so whichever slot renders reaches its normal boundary. Convention metadata and viewport are resolved against their independently selected branch paths.
Export the new selection types, validate selectors as layout-only server APIs in both route type generators and the RSC transform, and add coverage for direct handles, rewritten values, ancestor and nested selectors, independent metadata and viewport choices, navigation status, and selector error replay.
Verification
pnpm --filter=next typespnpm exec eslint --config eslint.config.mjs packages/next/src/build/webpack/plugins/next-types-plugin/index.ts packages/next/src/lib/metadata/metadata-parallel.tsx packages/next/src/lib/metadata/metadata-resolution-primitives.ts packages/next/src/lib/metadata/resolve-metadata-parallel.ts packages/next/src/lib/metadata/types/metadata-interface.ts packages/next/src/server/lib/router-utils/typegen.ts packages/next/src/server/typescript/constant.ts packages/next/src/types.ts test/e2e/app-dir/metadata-streaming-parallel-routescargo fmt --all -- --checkcargo test -p next-custom-transforms --test errors react_server_components_errorspnpm test-dev-turbo test/e2e/app-dir/metadata-streaming-parallel-routes/metadata-streaming-parallel-routes.test.tspnpm test-start-turbo test/e2e/app-dir/metadata-streaming-parallel-routes/metadata-streaming-parallel-routes.test.tspnpm test-start-webpack test/e2e/app-dir/metadata-streaming-parallel-routes/metadata-streaming-parallel-routes.test.ts