Runtime component responsible for walking the routing tree and dispatching updates to the appropriate handler.
This module is called by the generated handle/2 function and should not
be called directly in user code.
Dispatch algorithm
- Iterate over top-level scopes in declaration order.
- For each scope, evaluate all filters (AND logic, short-circuit on first false).
- After each passing filter, call
scope_extra/2if implemented — the returned map is merged intocontext.extrabefore proceeding to remaining filters and child scopes. Sibling scopes receive the original, un-enriched context. - If all filters pass and the scope is a leaf (has a handler), call the handler with the enriched context.
- If all filters pass and the scope is a branch (has children), recurse into children with the enriched context.
- If no scope matches, return the context unchanged (no-op).
Summary
Functions
Dispatches an update to the first matching handler in the routing tree.
Functions
@spec dispatch(term(), ExGram.Cnt.t(), [ExGram.Router.Scope.t()]) :: ExGram.Cnt.t()
Dispatches an update to the first matching handler in the routing tree.
Returns the context (potentially modified by the handler), or the original context unchanged if no handler matches.