Remove params from segment path (#82249)
When performing a segment prefetch, we send a "segment path" to the
server, which represents the particular segment that we're requesting.
Originally, I thought these needed to fully encode all the param values,
but since we already request the segments within the context of a
particular target page, it's unnecessary — the base URL already contains
all the param information (and is indeed the source of truth for where
the param values come from). The only thing we need to put in the paths
are the param names.
On the client, though, these segments are cached across pages (that's
the whole point of the Segment Cache). So in the prefetch cache, we do
need to cache them by their concrete param values.
Splitting out the param names and the param values into separate keys
will allow us to implement "fallback PPR" behavior for the client, where
if a segment entry does not reference a particular param, it can be
reused for all possible values of that param. (We already do this for
search strings.)
For now, I've split the current "segment path" key into two separate
keys, which I'm calling the "cache key" and the "request key". It's a
bit confusing since we have so many different types of cache keys, but I
think it's OK for now — this will be refactored soon anyway to support
the fallback PPR behavior.
Despite the line count, most of this PR is just a mechanical refactor.
Most of it was done by tab completion in Cursor. The substance of the
change is in the `segment-value-encoding.ts` file.