next.js
8ae1167c - [PPR Nav] Fix: Page data should always be applied (#60242)

Commit
2 years ago
[PPR Nav] Fix: Page data should always be applied (#60242) This fixes a case in the PPR navigations implementation where page data was not being applied. During a navigation, we compare the route trees of the old and new pages to determine which layouts are shared. If the segment keys of two layouts are the same, they are reused. However, the server doesn't bother to assign segment keys to the leaf segments (which we refer to as "page" segments) because they are never part of a shared layout. It assigns all of them a special constant (`__PAGE__`). In the PPR implementation, I overlooked this and compared the segment keys of all segments, including pages, not just shared layouts. So if the only thing that changed during a navigation was the page data, and not any parent layout, the client would fail to apply the navigation. The fix is to add a special case for page segments before comparing nested layouts. I also moved an existing special case for default pages, since those are also leaf segments and are conceptually similar.
Author
Parents
Loading