Sierra guide / Routing
Navigation
goto moves to a path, and url builds one with the configured trailing-slash policy. Both come from @frontierjs/sierra/router.
import { url } from '@frontierjs/sierra/router'
const href = url('/leads', { status: 'open', tier: 3 })
if (href !== '/leads/?status=open&tier=3') throw new Error(`unexpected url ${href}`)
In a component, goto('/leads/', { status: 'open' }) navigates there and resolves true once the route committed.
What else it can do
goto(path, query?, { scroll, replace, directives })resolvesfalsewhen a guard cancelled, the route failed to load, or a newer navigation won, and it never rejectsback()andforward()move through historyreload(path?, query?)starts the whole app again at a pathisActive('/leads/', { exact })is a prefix match for a nav highlight; namepage.routein the same expression, as inaria-current={(page.route, isActive('/leads/')) ? 'page' : null}setParams(obj)replaces the query andupdateParams(fn)merges it through a functiongetDirection()answers'next','prev'or'first'prefetch(path)preloads a route's chunk and data- A link with the
prefetchattribute prefetches at once,prefetch="hover"on mouseenter, andprefetch="visible"when it scrolls into view - A prefetched payload is dropped on any change of identity, so a sign-out cannot serve the last person's data
In depth: Sierra README § Navigation API, § Prefetching