next.js
3d29c270 - [Prefetching] Fix: Read segment data from correct source (#72427)

Commit
1 year ago
[Prefetching] Fix: Read segment data from correct source (#72427) In the last PR (#72367) I got confused and incorrectly assumed that initialRSCPayload was a client Flight value, not a server value. Which meant it was actually re-rendering the Server Components again, rather than reusing the result from the page render. Instead, I need to decode this value from the full page Flight stream, like I did originally. (Except we still don't need to do it once per segment, just once per page.) To avoid another unecessary decoding of the page stream, I've moved the segment rendering tasks so that they are spawned from inside the render that generates the tree metadata response. The size of the diff is bit misleading; mostly this involves just rearranging the code so that it executes in a slightly different order.
Author
Parents
Loading