next.js
44ab1be4 - Support MPA navigations in `instant()` (#89469)

Commit
4 days ago
Support MPA navigations in `instant()` (#89469) Based on: - https://github.com/vercel/next.js/pull/89465 --- The `instant()` testing API allows e2e tests to assert on prefetched UI before dynamic data streams in. This extends it to handle full page navigations: page reloads, plain anchor clicks, and browser back/forward. For client-side navigations, the API uses request headers to trigger static shell rendering. For MPA navigations, headers aren't available, so this uses a cookie-based approach instead. When `instant()` acquires a lock, it sets a cookie that tells the server to render the static shell. When the lock is released, the cookie is cleared and the page reloads to fetch dynamic content. On pages loaded with the test cookie, hydration is skipped entirely and a minimal testing API is set up in the bootstrap script. This is similar to how the `__nextppronly` debug parameter works (an internal experiment that was never shipped). This feature is the productionized version of that approach, designed for actual use in e2e tests. New test cases: - Static shell on page reload - Static shell on plain anchor navigation - Multiple MPA navigations within a single `instant()` scope - Verifies navigations work normally after exiting `instant()` scope
Author
Parents
Loading