next.js
70e3b156 - Add SegmentStore for per-segment async local storage

Commit
2 days ago
Add SegmentStore for per-segment async local storage Part of a series of refactors to prepare for encoding params as Server References. No outward behavioral changes yet, just refactoring. Adds a per-request, per-segment storage mechanism: every route segment has its own SegmentStore, keyed by its LoaderTree node — conceptually, as if every route module exported its own store. The stores hang off the WorkUnitStore, so the state they hold is request-scoped. This will primarily be for storing objects related to params. They need to be accessible via the module system so that React can map a Server Reference back to its corresponding segment (eventually, once we land this feature). The first thing we migrate to being tracked on the SegmentStore is the vary params accumulator. In subsequent steps, we'll move search params and params, too.
Author
Committer
Parents
Loading