mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #243] [MERGED] fix: normalize null-prototype params from matchPattern() for RSC serialization #412
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#412
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/243
Author: @gagipro
Created: 3/3/2026
Status: ✅ Merged
Merged: 3/4/2026
Merged by: @southpolesteve
Base:
main← Head:fix/rsc-null-prototype-params📝 Commits (1)
04a4a62fix: normalize null-prototype params from matchPattern() for RSC serialization📊 Changes
2 files changed (+34 additions, -11 deletions)
View changed files
📝
packages/vinext/src/server/app-dev-server.ts(+21 -7)📝
packages/vinext/src/shims/metadata.tsx(+13 -4)📄 Description
Summary
matchPattern()usesObject.create(null), producing objects withoutObject.prototype. The RSC serializer rejects these during dynamic route rendering, causing 500 errors on all dynamic routes (e.g./dashboards/[id]).Fixes #241
Fix
A
makeThenableParams()helper that satisfies both constraints:{...obj}) normalizes the null prototype → RSC serializer accepts itObject.assignonto the Promise preserves synchronous property access (params.id,params.slug) for pre-Next.js 15 codeThis replaces the previous
Object.assign(Promise.resolve(params), params)pattern at all 6 call sites inapp-dev-server.tsand 3 inmetadata.tsx. The old pattern passed the original null-prototype object to bothPromise.resolve()andObject.assign()— while the thenable worked, the resolved value still had a null prototype causing RSC serialization failure.Files Changed (2 files, 1 commit)
packages/vinext/src/server/app-dev-server.tsmakeThenableParams(), replaced 6Object.assign(Promise.resolve(x), x)sites, updated stale commentpackages/vinext/src/shims/metadata.tsxmakeThenableParams<T>(), replaced 3 call sites, updated commentTesting
params.id,params.slug, catch-all routes (params.slug.join()),generateMetadata()with async params — all passvs. PR #242
This is a replacement for #242, which was correctly identified by review as breaking synchronous params access. Changes from #242:
Promise.resolve({...obj})→Object.assign(Promise.resolve({...obj}), {...obj})— preserves backward compatcredentials: "same-origin"changes (4 fetch calls)findReactServerPackages()feature.gitignorechangelink.tsx/navigation.tschanges🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.