next.js
6599b32f - ensure aliased prefetches return correct segment key (#69850)

Commit
1 year ago
ensure aliased prefetches return correct segment key (#69850) When returning an aliased prefetch, we need to make sure the final tree that is produced contains the final searchParams, as otherwise the router might not properly re-key the component to reflect the changed search value. This moves the existing util that handled appending `searchParams` to the `__PAGE__` segment into the shared segment helpers. On the client, when we detect that we returned an aliased prefetch, we update the segment key with the "final" data by calling this helper with the final searchParams. This also fixes a missing `aliased` detection in the case where we do find an entry as it's possible the entry matches the path, but not the search. It wasn’t sufficient to only do this for full prefetches because while auto prefetches won’t return the CacheNode data, it will return a tree, so we need to make sure the tree contains the right params. Fixes #69847
Author
Parents
Loading