Skip to content

Function: resolveFrameworkParams()

API / @xmachines/play-router / index / resolveFrameworkParams

function resolveFrameworkParams(__namedParameters): Record<string, string>;

Defined in: packages/play-url/src/framework-params.ts:261

Decides which params describe the route of the machine.

The four branches, in the order that they apply:

  • The pattern declares no name — a static path, a bare * wildcard, or an unknown stateId. The answer is {}. The params of the framework must NOT travel here: under a catch-all they hold the splat of the host, and that value would reach the actor as a param of the machine. A bare * names nothing that a machine can read, and URLPattern numbers its group 0.
  • The bridge sits under a mount — the framework matched a route of the HOST by construction, because the machine owns the suffix of the path only. Its params therefore describe this pattern never, whatever they are named, and a name that happens to collide carries the value of the host. Read the params of the machine from its own pattern instead.
  • The framework covers every REQUIRED name — it matched the machine route. Keep its parse, together with its decoding. An optional :name? that the framework reports not is covered too: a segment that did not match has no value. A gap in a required name falls back, because keeping it would drop a name the route declares.
  • The path IS the bare form of the pattern — every optional part is absent, so {} is the complete answer. The branch reads the path and trusts the framework with nothing, which is what makes it safe under a catch-all of the host, and it calls URLPattern for a location that needs none.

What these branches decide is whether a NAVIGATION compiles and runs a URLPattern again. The API itself is always present: url-pattern-utils.ts imports the polyfill as an ordinary dependency, and no code path asks whether the runtime carries the native one.

Parameters

ParameterType
__namedParametersFrameworkParamsSource

Returns

Record<string, string>

The path parameters of the machine route, or {}.