5f98e9bc6e
### What? When using rewrites, in the scenario where a user visits an intercepted route, reloads the page, goes back, and then revisits the same route, we serve the page rather than the intercepted route. ### Why? #59094 fixed the case where `ACTION_RESTORE` was not restoring `nextUrl` properly. However there's a separate issue where when the `SERVER_PATCH` action comes in, `handleMutable` attempts to compute `nextUrl` by comparing the patched tree with the current tree. In the case of the popstate event, both trees are the same, so the logic is currently configured to fallback to `canonicalUrl`, which is not the correct URL to use in the case of rewrites. ### How? If the computed changed path is null, we should only fallback to using `canonicalUrl` if we don't have a valid `nextUrl` that we can use. Closes NEXT-1747 Fixes #56072 |
||
---|---|---|
.. | ||
app | ||
interception-middleware-rewrite.test.ts | ||
middleware.ts | ||
next.config.js | ||
tsconfig.json |