rsnext/test
Zack Tanner d371f648d2
Renew prefetch cache entry after update from server (#61573)
### What
When a prefetch cache entry becomes "stale", it'll remain stale until
eventually it gets evicted. However during that stale window, the cache
is never revalidated, and so instant navigations stop working and data
is fetched from origin every navigation.

### Why
The `lastUsedTime` entry on the prefetch cache is currently only updated
after the first read. Once it becomes stale, `applyFlightData`'s
recursive functions will see that there is no longer a reusable prefetch
cache entry, and will trigger a lazy fetch of the new data on every
subsequent navigation.

### How
This updates prefetch cache handling to always ensure we’re using a
fresh or reusable prefetch cache entry. This means that stale prefetch
entries will be refreshed on a navigation event. As a result of this,
I’ve had to disable one of our tests that relies on this stale cache
behavior. It’s not ideal that we’re blocked on the loading boundary when
fetching child segment data—ideally we can refactor this to cache the
loading component in the CacheNode and copy it over on navigations,
similar to how ‘head’ is handled. I’ll work on this in a separate PR.

Note: The new client cache test for this is disabled in PPR for the same
reason as the other tests: auto prefetching with PPR navigations is
currently loading fresh data rather than reusing the prefetch cache.


Fixes #58969
Fixes #58723
Closes NEXT-1904
2024-02-20 09:07:18 -08:00
..
.stats-app Reduce memory/cache overhead from over loader processing (#62005) 2024-02-13 22:40:19 +00:00
development refactor(turbopack): resolve routes by page name instead of pathname (#61778) 2024-02-19 15:13:39 +00:00
e2e Renew prefetch cache entry after update from server (#61573) 2024-02-20 09:07:18 -08:00
examples feat(cli): introduce --tailwind flag (#46927) 2023-03-16 16:06:27 +01:00
integration fix(create-next-app): add --no-import-alias for non-interactive (#62035) 2024-02-20 10:23:04 -05:00
lib refactor(tests): make chain more "correct" (#51728) 2024-02-14 20:14:24 +01:00
production Tree shake the unused exports in direct relative imported client component module (#62238) 2024-02-20 17:07:25 +01:00
unit fix:(next/image) handle remotePatterns with a dot in the pathname (#60488) 2024-02-08 18:21:29 -05:00
.gitignore ci(workflow): enable test trace upload (#51107) 2023-06-12 17:14:13 +00:00
build-turbopack-tests-manifest.d.ts Update Turbopack test manifest from GitHub Actions artifact (#58394) 2023-11-24 16:48:12 +01:00
build-turbopack-tests-manifest.js tests are no longer flaky (#62278) 2024-02-20 14:44:11 +01:00
get-test-filter.js run tests from test suite that are not listed in the manifest (#58401) 2024-01-11 07:38:35 +00:00
jest-setup-after-env.ts Decrease default test timeouts (#56116) 2023-09-27 23:55:20 +00:00
ppr-tests-manifest.json Renew prefetch cache entry after update from server (#61573) 2024-02-20 09:07:18 -08:00
readme.md
test-file.txt
tsconfig.json chore: extends from shared base tsconfig (#59776) 2023-12-19 18:52:22 +01:00
turbopack-tests-manifest.json fix(turbopack): print missing slots in debug message (#62280) 2024-02-20 16:22:15 +01:00

See Testing for more information on how you can run/write/debug tests for Next.js.