Fix shallow routing with rewrites/middleware (#37716)
Shallow route changes did not work for rewritten pages when Middleware was used, and made hard refreshes, although it was possible with static rewrites. This happened because the router has a manifest of the static rewrites, allowing static rewrites to map the route before comparing with the local cache. Middleware rewrites are dynamic and happening on the server, so we can't send a manifest easily. This means that we need to propagate the rewrites from the data requests into the components cache in the router to make sure we have cache hits and don't miss. This commit does exactly that and adds a test to verify that it works. This fixes #37072 and fixes #31680 _Note:_ there's one thing that is somewhat an issue though: if the first page the user lands on is a rewritten page, and will try to make a shallow navigation to the same page--we will make a `fetch` request. This is because we don't have any client cache of the `rewrite` we just had. ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md`
Showing
Please
register
or
sign in
to comment