mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
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#720
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/620
Author: @yunus25jmi1
Created: 3/21/2026
Status: ✅ Merged
Merged: 3/22/2026
Merged by: @james-elicx
Base:
main← Head:fix/issue-589📝 Commits (2)
46e0f2cfix: prevent useActionState state becoming undefined when redirect() is called84a845cApply suggestion from @ask-bonk[bot]📊 Changes
4 files changed (+64 additions, -8 deletions)
View changed files
📝
packages/vinext/src/server/app-browser-entry.ts(+8 -8)📝
tests/e2e/app-router/server-actions.spec.ts(+19 -0)➕
tests/fixtures/app-basic/app/action-state-redirect/page.tsx(+22 -0)📝
tests/fixtures/app-basic/app/actions/actions.ts(+15 -0)📄 Description
Description
This PR fixes issue #589 where
useActionStatereceivesundefinedstate when a Server Action callsredirect()fromnext/navigation, causing aTypeErroron the next render.Problem
When a server action used with
useActionStatecallsredirect():useActionStatewithundefinedstateExample:
Root Cause
Server action redirects were sending empty response body with only headers:
RSC navigation requires a valid RSC payload to parse and render. Empty body causes navigation to fail.
Solution
Pre-render the redirect target's RSC payload on the server and include it in the response body. This matches Next.js behavior where the redirect response includes the target page's RSC payload for soft SPA navigation.
Server-side (app-rsc-entry.ts)
Client-side (app-browser-entry.ts)
Benefits
Changes
Core Fix
packages/vinext/src/entries/app-rsc-entry.ts: Pre-render redirect target's RSC payloadpackages/vinext/src/server/app-browser-entry.ts: Use RSC navigation when payload available, fallback to hard redirectTest Coverage
tests/fixtures/app-basic/app/actions/actions.ts: AddedredirectWithActionStatetest actiontests/fixtures/app-basic/app/action-state-redirect/page.tsx: Added test pagetests/e2e/app-router/server-actions.spec.ts: Added E2E test for issue #589 with waitForHydrationTesting
Related Issues
Signed-off-by: Md Yunus admin@yunuscollege.eu.org
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.