Skip to content

Function: resolveFrameworkParams()

API / @xmachines/play-router / resolveFrameworkParams

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

Defined in: play-router/src/framework-params.ts:298

Decides which params describe the route of the machine.

The three 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. This branch also reaches no URLPattern, which matters: the extraction needs the constructor even for a pattern with no parameter, so a delegation would throw on a runtime without the API.
  • 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 segment 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.

None of this decides whether the APPLICATION needs a URLPattern polyfill. A RouteMap that holds one parameterized route compiles it in the CONSTRUCTOR, and it throws a URLPatternUnavailableError there when the runtime has no URLPattern. The polyfill question is therefore settled at startup: only a route map of static paths alone escapes it. What these branches decide is whether a NAVIGATION calls URLPattern again.

Parameters

ParameterType
__namedParametersFrameworkParamsSource

Returns

Record<string, string>

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