next.js
ae6d43b8 - Fix: Update the URL when a client navigation redirects to a rewritten route (#95207)

Commit
25 days ago
Fix: Update the URL when a client navigation redirects to a rewritten route (#95207) On a client-side navigation, when a proxy/middleware redirected the requested URL to a destination that was itself rewritten to a dynamically rendered route, the page content updated correctly but the address bar stayed on the original URL. Hard navigations (reload, typing the URL) were unaffected. This happened because the navigation optimistically committed the predicted URL up front, and when the redirect resolved to a route with the same shape as the prediction, the router treated the navigation as already correct and never reconciled the address bar. A redirect discovered during a navigation now invalidates the prediction and re-resolves the route, so the address bar reflects the redirect destination. Adds an end-to-end test covering the regression. Fixes #95195
Author
Parents
Loading