next.js
84bda027 - experimental_prepare: Don't refetch on commit due to stale inlining hints (#101234)

Commit
7 days ago
experimental_prepare: Don't refetch on commit due to stale inlining hints (#101234) ## Summary Fixes a narrow case where committing a prepared navigation (`router.experimental_prepare()`) fetches the route a second time. It only happens when the route wasn't already in the route cache when the prepare started, and the page was prerendered at build time. Build-time prerenders are marked with `InliningHintsStale`, which causes the client to write their route cache entry already expired. So when the commit looks up the route, it misses the entry the prepare just wrote, and fetches the route again. To fix this, the prepare saves the result of its route request on the preparation record, and the commit uses it instead of making a new request. It's subject to the same checks as taking over an in-flight request. This is a workaround for `InliningHintsStale`. Once that mechanism is removed, this can be too. Alternative to #101163; test cases adapted from that PR. ## Verification - Not run: `pnpm test-start-turbo test/e2e/app-dir/prepare-navigation/prepare-navigation.test.ts` (left to CI) <!-- NEXT_JS_LLM --> Co-authored-by: Chris Hahn <chris.hahn@vercel.com>
Author
Parents
Loading