next.js
45a5405d - bugfix: propagate staleTime to seeded prefetch entry (#81263)

Commit
303 days ago
bugfix: propagate staleTime to seeded prefetch entry (#81263) In #71280, we hooked up the server-side `staleTime` header to the client-side prefetch cache. This means that if the server responds with a staleTime value, the client router will use that rather than the previous heuristic when determining if a prefetch entry can be reused. However, there was missing functionality to set a proper staleTime value for the initially seeded prefetch entry (aka the first page visit). In the case of customizing staleTimes, this meant that navigations back to the original page would defer back to the old stale heuristic, which would differ from subsequent navigations that were properly seeded with a staleTime. Separately, I believe that it's problematic that if the `staleTime` header is present, that we honor that and only set a fresh/stale cache status, because the newer heuristic doesn't consider the `reusable` cache status. This should probably be flagged to the clientSegmentCache flag. However, to minimize the changes here, I've only addressed this particular case.
Author
Parents
Loading