rsnext/test/e2e/app-dir/pages-to-app-routing/app
JJ Kasper 1149cccd94
Add client router filter handling (#46283)
This adds a new client router filter for app paths and redirects so that
we correctly hard navigate when a transition for one of this paths is
encountered. This fixes the longstanding issue where redirects weren't
applied on the client so a redirect that matches a dynamic route as well
would transition to the dynamic route on client transition but not on
direct visit. Similarly this ensures we hard navigate to app paths from
pages even if a page dynamic route matches the path.

The specific filter leveraged here is a bloom filter as we can tolerate
some false matches (currently targeting an error rate of `2%`) as they
just trigger a hard navigation which should be acceptable and this also
avoids needing to send an entire manifest with the related paths.

We can leverage a manifest for the generated SSG paths as well in a
follow-up to fix `fallback: false` routes not being navigated correctly
on client-transition in some cases as well.


The filter is initially behind an `experimental.clientRouterFilter` flag
in `next.config.js` although this is auto-enabled when leveraging app
directory to ensure proper transitions.

fixes NEXT-609
closes: https://github.com/vercel/next.js/pull/46235
x-ref: [slack
thread](https://vercel.slack.com/archives/C035J346QQL/p1677028663246719)

x-ref: https://github.com/vercel/next.js/issues/41344
x-ref: https://github.com/vercel/next.js/issues/40062
x-ref: https://github.com/vercel/next.js/issues/37889
x-ref: https://github.com/vercel/next.js/discussions/26426
x-ref: https://github.com/vercel/next.js/issues/35837

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)
2023-02-22 22:02:31 -08:00
..
about Add client router filter handling (#46283) 2023-02-22 22:02:31 -08:00
layout.tsx Add client router filter handling (#46283) 2023-02-22 22:02:31 -08:00