rsnext/test/e2e
Zack Tanner ad98cda23b
fix interception route refresh behavior with dynamic params (#64006)
### What
When triggering an interception route that has a parent with dynamic
params, and then later going to "refresh" the tree, either by calling
`router.refresh` or revalidating in a server action, the refresh action
would silently fail and the router would be in a bad state.

### Why
Because of the dependency that interception routes currently have on
`FlightRouterState` for dynamic params extraction, we need to make sure
the refetch has the full tree so that it can properly extract earlier
params. Since the refreshing logic traversed parallel routes and scoped
the refresh to that particular segment, it would skip over earlier
segments, and so when the server attempted to diff the tree, it would
return an updated tree that corresponded with the wrong segment
(`[locale]` rather than `["locale", "en", "d]`).

Separately, since a page segment might be `__PAGE__?{"locale": "en"}`
rather than just `__PAGE__`, this updates the refetch marker logic to do
a partial match on the page segment key.

### How
This keeps a reference to the root of the updated tree so that the
refresh always starts at the top. This has the side effect of
re-rendering more data when making the "stale" refetch request, but this
is necessary until we can decouple `FlightRouterState` from interception
routes.

shout-out to @steve-marmalade for helping find this bug and providing
excellent Replays to help track it down 🙏

x-ref:

- https://github.com/vercel/next.js/discussions/63900

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->


Closes NEXT-2986
2024-04-03 09:03:58 -07:00
..
404-page-router fix(turbopack): e2e/404-page-router test (#58146) 2023-11-22 19:30:26 +01:00
app-dir fix interception route refresh behavior with dynamic params (#64006) 2024-04-03 09:03:58 -07:00
app-dir-legacy-edge-runtime-config fix(DX): More precise error messages for export const config deprecation (#54492) 2023-08-25 16:25:15 +00:00
basepath Add hasRedbox fix (#60522) 2024-01-15 09:36:44 +01:00
browserslist Skip browserslistrc tests (#61294) 2024-01-29 10:51:44 +01:00
browserslist-extends
cancel-request Try to fix flakey socket hang up failures in stream cancel tests (#53318) 2023-07-28 22:59:24 +00:00
children-page fix: pages not visible in dev when named children (#54007) 2023-08-15 03:50:37 +00:00
config-promise-export
config-schema-check Polish compiling and turbopack logging (#57270) 2023-10-23 19:28:36 +00:00
conflicting-app-page-error Fix conflicting-app-page-error test for Turbopack (#62747) 2024-03-02 11:00:05 +00:00
custom-app-render Redesign nextjs logging (#54713) 2023-09-05 11:40:00 +00:00
disable-js-preload Enable App Router for all applications (#49088) 2023-05-04 17:47:10 +02:00
dynamic-route-interpolation fix: support both decoded and encoded url requests of conventioned files (#56187) 2023-10-03 00:02:49 +02:00
edge-api-endpoints-can-receive-body
edge-async-local-storage
edge-can-read-request-body chore: drop form-data (#57141) 2023-10-20 19:25:42 +00:00
edge-can-use-wasm-files Fix edge-can-use-wasm-files test for Turbopack (#63552) 2024-03-21 11:05:02 +01:00
edge-compiler-can-import-blob-assets feat: drop Node.js 16 (#56896) 2023-10-16 21:41:38 +00:00
edge-compiler-module-exports-preference test: rename node_modules_bak to node_modules (#62066) 2024-02-15 00:42:35 +01:00
edge-configurable-runtime Rename process.env.TURBOPACK -> process.env.TURBOPACK_DEV in test skips (#63665) 2024-03-25 14:17:56 +01:00
edge-pages-support Revert "Ensure dynamic routes dont match _next/static unexpectedly" (#62691) 2024-02-29 08:34:11 -08:00
edge-runtime-pages-api-route Fix issue with outputFileTracingExcludes and pages/api edge runtime (#59157) 2023-12-15 16:27:03 +01:00
edge-runtime-uses-edge-light-import-specifier-for-packages test: rename node_modules_bak to node_modules (#62066) 2024-02-15 00:42:35 +01:00
esm-externals Turbopack: app externals test case improvements (#62871) 2024-03-14 07:22:40 +00:00
favicon-short-circuit Short circut 404's for /favicon.ico in development (#54747) 2023-08-30 16:15:19 +00:00
fetch-failures-have-good-stack-traces-in-edge-runtime Add hasRedbox fix (#60522) 2024-01-15 09:36:44 +01:00
getserversideprops Revert "Ensure dynamic routes dont match _next/static unexpectedly" (#62691) 2024-02-29 08:34:11 -08:00
handle-non-hoisted-swc-helpers
hello-world Bail out of 404 page when favicon.ico doesn't exist (#50795) 2023-06-06 10:58:40 +02:00
i18n-api-support
i18n-data-fetching-redirect
i18n-data-route Strip internal routing headers (#55114) 2023-09-07 22:08:53 +00:00
i18n-default-locale-redirect
i18n-disallow-multiple-locales
i18n-ignore-redirect-source-locale
i18n-ignore-rewrite-source-locale Skip i18n-ignore-rewrite-basepath-source irrelevant tests with turbopack (#57295) 2023-10-23 15:01:24 -07:00
i18n-preferred-locale-detection Migrate locale redirect handling to router-server (#62606) 2024-02-27 16:37:11 -08:00
ignore-invalid-popstateevent refactor(tests): make chain more "correct" (#51728) 2024-02-14 20:14:24 +01:00
instrumentation-hook fix: call instrumentationHook earlier for prod server (#63536) 2024-03-21 13:11:03 +00:00
instrumentation-hook-src add support for instrumentation (#59070) 2023-11-29 20:01:38 +01:00
link-with-api-rewrite
manual-client-base-path Update manual basePath with trailingSlash (#51726) 2023-06-23 15:36:16 -07:00
middleware-base-path
middleware-custom-matchers
middleware-custom-matchers-basepath
middleware-custom-matchers-i18n
middleware-dynamic-basepath-matcher chore: fix flaky middleware matcher test (#49555) 2023-05-09 22:37:03 +00:00
middleware-fetches-with-any-http-method
middleware-fetches-with-body Revert "Revert "Separate routing code from render servers (#52492)"" (#53029) 2023-07-21 14:02:52 -07:00
middleware-general refactor(tests): make chain more "correct" (#51728) 2024-02-14 20:14:24 +01:00
middleware-matcher
middleware-redirects
middleware-request-header-overrides type check tests (and convert next-test-utils.js to ts) (#51071) 2023-06-23 17:42:50 +00:00
middleware-responses
middleware-rewrites Fix middleware catch-all rewrite case (#63254) 2024-03-13 14:14:04 -07:00
middleware-shallow-link
middleware-trailing-slash Revert "Revert "Update split chunk handling for edge/node" (#62313)" (#62336) 2024-02-21 11:40:29 -08:00
module-layer Update module-layer test for Turbopack (#60707) 2024-01-16 18:36:35 +00:00
multi-zone refactor(test): switch tests to use pnpm in more places (#63196) 2024-03-20 15:00:58 -04:00
new-link-behavior chore(test): fix false-positive tests (#63242) 2024-03-21 01:24:33 +01:00
next-font build: Update turbopack (#63229) 2024-03-13 10:13:56 +00:00
next-head Ensure tests suites have unique names (#56085) 2023-09-27 13:55:45 +02:00
next-image-forward-ref
next-phase Fix next phase for next build (#60969) 2024-01-22 15:37:04 +01:00
next-script Skip experimental.nextScriptWorkers test for Turbopack (#56086) 2023-09-27 13:58:11 +02:00
no-eslint-warn-with-no-eslint-config
nonce-head-manager Ensure tests suites have unique names (#56085) 2023-09-27 13:55:45 +02:00
og-api Remove experimental config from create-next-app (#49241) 2023-05-05 00:22:28 -07:00
opentelemetry OTEL: use the current context when creating a root span (#63825) 2024-03-28 20:26:37 +00:00
optimized-loading Enable App Router for all applications (#49088) 2023-05-04 17:47:10 +02:00
pages-performance-mark Fix performance measures crashing the app (#54858) 2023-09-01 14:51:38 +00:00
postcss-config-cjs
prerender
prerender-native-module
proxy-request-with-middleware
react-dnd-compile Failing test for 59195 (#59210) 2023-12-04 05:13:28 +01:00
reload-scroll-backforward-restoration
repeated-forward-slashes-error
skip-trailing-slash-redirect Use consistent name for App Router tests (#56352) 2023-10-06 11:06:06 +02:00
socket-io Fix unmatched WebSocket upgrade requests being closed (#57245) 2023-10-23 17:23:34 +00:00
ssr-react-context
streaming-ssr Revert "Ensure webpack build worker defaults on" (#62342) 2024-02-21 12:00:18 -08:00
styled-jsx test: rename node_modules_bak to node_modules (#62066) 2024-02-15 00:42:35 +01:00
swc-warnings Fix e2e/swc-warnings (#61265) 2024-01-27 19:51:57 +01:00
switchable-runtime feat(log): improve dev/build logs (#62946) 2024-03-26 15:33:09 +01:00
test-template/{{ toFileName name }} chore: update test template to use nextTestSetup (#62154) 2024-02-16 17:30:54 +01:00
test-utils-tests/basic chore: update test template to use nextTestSetup (#62154) 2024-02-16 17:30:54 +01:00
testmode Improve experimental test proxy (#63567) 2024-03-21 21:31:29 +00:00
third-parties Adding Google analytics to next/third-parties (#58418) 2023-12-11 18:21:32 +00:00
trailingslash-with-rewrite
transpile-packages test: rename node_modules_bak to node_modules (#62066) 2024-02-15 00:42:35 +01:00
type-module-interop Add hasRedbox fix (#60522) 2024-01-15 09:36:44 +01:00
typescript-version-no-warning Bump to typescript@5.1 (#50557) 2023-06-08 17:18:37 +00:00
typescript-version-warning Redesign nextjs logging (#54713) 2023-09-05 11:40:00 +00:00
undici-fetch feat: make enableUndici: true default and remove node-fetch (#49061) 2023-05-02 04:10:59 +00:00
useselectedlayoutsegment-s-in-pages-router fix(navigation): allow useSelectedLayoutSegment(s) in Pages Router (#62584) 2024-02-29 13:14:52 +00:00
yarn-pnp/test Disable Yarn PnP tests for Turbopack (#61040) 2024-01-23 21:25:20 +01:00
basepath-trailing-slash.test.ts Add hasRedbox fix (#60522) 2024-01-15 09:36:44 +01:00
basepath.test.ts Add hasRedbox fix (#60522) 2024-01-15 09:36:44 +01:00
example-file.txt
example.txt chore: update test template to use nextTestSetup (#62154) 2024-02-16 17:30:54 +01:00
prerender-crawler.test.ts
prerender-native-module.test.ts server: re-land bundled runtimes (#55139) 2023-09-08 16:05:29 +00:00
prerender.test.ts Update flakey prerender fallback test (#64001) 2024-04-02 15:31:31 -07:00