Commit graph

56 commits

Author SHA1 Message Date
Gal Schlezinger
7193effcc0
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`
2022-06-15 15:09:13 +00:00
JJ Kasper
bf7bf8217f
Ensure navigating with middleware parses route params correctly (#37704) 2022-06-15 09:09:51 -05:00
Javi Velasco
c501842311
Add test combining middleware & config rewrites (#37667)
* Add test combining middleware & config rewrites

* Add `afterFiles` test

* update some tests

* Apply suggestions from code review

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-06-14 17:31:33 -05:00
JJ Kasper
e7f08ef040
Ensure custom middleware matcher is used correctly in client manifest (#37672)
* Ensure custom middleware matcher is used correctly in client manifest

* lint-fix

* patch e2e case

* fix rsc case

* update test

* add missing normalize
2022-06-13 22:07:40 -05:00
JJ Kasper
934e5a4835
Update usage of example.com -> example.vercel.sh (#37630)
* Update usage of example.com -> example.vercel.sh

* another one

* another flakey test
2022-06-10 18:19:37 -05:00
JJ Kasper
607ff2b322
Update to process redirects/rewrites for _next/data with middleware (#37574)
* Update to process redirects/rewrites for _next/data

* correct matched-path resolving with middleware

* Add next-data header

* migrate middleware tests

* lint-fix

* update error case

* update test case

* Handle additional resolving cases and add more tests

* update test from merge

* fix test

* rm .only

* apply changes from review

* ensure _next/data resolving does not apply without middleware
2022-06-10 12:35:12 -05:00