Skip to main content
On this pageFunctions

Route/Transition

Functions

coldLoad

functionsource
/**
 * Builds the Transition for a cold load (a direct visit, a
 *  bookmark, a reload). There is no previous route, so isEntering
 *  counts the transition as an entry.
 */
<Route>(nextRoute: Route): Transition<Route>

entered

functionsource
/**
 * The route a transition entered, if it entered one: `Some(nextRoute)`
 *  when the next route's tag differs from the previous route's (a cold
 *  load counts as an entry), `None` when the transition stayed within one
 *  route, for example between two ids of one detail route. Match on the
 *  result to dispatch entry Commands for many routes in one place; for a
 *  single route, isEntering is the plain predicate form.
 */
<Route extends Readonly<{
  _tag: string
}>>(__namedParameters: Transition<Route>): Option<Route>

isEntering

functionsource
/**
 * Predicate for "this transition entered the given route": the next
 *  route carries the tag and the previous route did not (a cold load
 *  counts as an entry). Navigating within the same route, for example
 *  between two ids of one detail route, is not an entry.
 * 
 *  Pin the application's route union once and alias it:
 * 
 *  ```ts
 *  export const isEntering = Transition.isEntering<AppRoute>
 *  ```
 */
<Route extends Readonly<{
  _tag: string
}>>(routeTag: Route["_tag"]): (transition: Transition<Route>) => boolean

make

functionsource
/**
 * Builds the Transition for an in-app navigation, from the route
 *  the Model still holds to the route the new URL parsed to. Arguments
 *  read in travel order: previous first, next second.
 */
<Route>(
  previousRoute: Route,
  nextRoute: Route
): Transition<Route>

Types

Transition

typesource
/**
 * A route change: where the application was and where it is now.
 *  `maybePreviousRoute` is `None` on the first render (a cold load), which
 *  isEntering treats as an entry. Build one with coldLoad
 *  in `init` and with make wherever the application handles its
 *  ChangedUrl Message, then hand it to per-cache step functions so `init`
 *  and navigation share one loading policy.
 */
type Transition = Readonly<{
  maybePreviousRoute: Option.Option<Route>
  nextRoute: Route
}>

Stay in the update loop.

New releases, patterns, and the occasional deep dive.


Built with Foldkit.

© 2026 Devin Jameson