rsnext/test/integration/prerender-preview
Kam Figy b95bc4b74b
Prevent storing page props cache when in SSG + preview mode (#30757)
In Next 12, `router.replace()` treats the page props cache as authoritative when fetching SSG props in preview mode. This makes sense outside preview mode (static props won't change), but within preview mode this prevents reloading the preview data dynamically without force-refreshing the page.

This PR fixes the problem by instructing Next to bypass the props cache if it's an SSG route AND preview mode is on.

Repro: https://github.com/kamsar/next-replace-previewmode-staticprops/blob/main/pages/index.js



## Bug

- [x] Related issues linked using `fixes #number`: Fixes https://github.com/vercel/next.js/issues/30756
- [ ] Integration tests added: Did not find existing tests for the router, but I'd be happy to write one if someone could point me in the right direction.
2021-11-02 00:42:29 +00:00
..
pages Prevent storing page props cache when in SSG + preview mode (#30757) 2021-11-02 00:42:29 +00:00
test Prevent storing page props cache when in SSG + preview mode (#30757) 2021-11-02 00:42:29 +00:00
server.js Preview Mode Should Not Cache (#10636) 2020-02-22 10:26:39 +01:00