Files
c7df8e9920 fix: trigger MPA navigation for server action redirects with build ID mismatch (#89946)
## Summary

- Fixes cross-zone server action redirect failure where `redirect()`
inside a server action produces a blank page when the target path is
served by a different Next.js zone (separate Vercel project, same
domain)
- Adds build ID validation to `server-action-reducer.ts`, matching the
existing pattern in `fetch-server-response.ts`
- Adds e2e test in the deployment-skew test suite to verify server
action redirects with build ID mismatch trigger MPA navigation

## Background

When a server action calls `redirect()`, the server pre-fetches the
redirect target and includes the RSC data in the response. In a
multi-zone setup (same domain, different Next.js projects), this
pre-fetched RSC data comes from a different build with a different build
ID.

The `fetch-server-response.ts` file already checks for build ID
mismatches during regular navigations (line 245-251) and triggers MPA
navigation when detected. However, `server-action-reducer.ts` was
missing this check, causing the client to try to apply the foreign RSC
payload — resulting in a blank page.

## Fix

Added a build ID check in `fetchServerAction()` after parsing the RSC
response. When a mismatch is detected, the flight data is discarded. The
existing reducer logic at line 364-370 already handles this case:

```typescript
if (flightData === undefined && redirectLocation !== undefined) {
  return completeHardNavigation(state, redirectLocation, navigateType)
}
```

This triggers an MPA navigation (full page load), which is the correct
behavior for cross-zone redirects.

## Repro

- https://repro-main-app.vercel.app/test-redirect
- Red button (server action redirect) → blank page (before fix) / full
page load (after fix)
  - Green link (normal `<a>`) → works fine

Closes https://linear.app/vercel/issue/NEXT-4856

---------

Co-authored-by: Zack Tanner <[email protected]>
2026-03-06 14:17:36 -08:00
..
…