next.js
7719360c - bugfix: ensure rsc isn't reused for page segments when reusing loading data (#69123)

Commit
1 year ago
bugfix: ensure rsc isn't reused for page segments when reusing loading data (#69123) Follow up to #68340: When a prefetch is aliased (meaning we returned a prefetch entry that corresponded with the same pathname, but different / missing search params), we signal to the router that it should only copy the loading state from this prefetch entry, and null everything else out so it can be fetched from the server. In the original implementation I was always copying over `rsc`, but `rsc` can correspond with the page segment data, meaning we'd potentially be copying over the final page data as well. We should only copy over the `rsc` portion of the `CacheNode` if we know it's not the page segment. To catch this regression I added a link with a full prefetch on the existing test cases for this, which causes the test to fail without this patch applied because it'll copy over the full prefetch RSC data and not actually fetch new data from the server.
Author
Parents
Loading