Site / Creating a site

History, once

Which moves add a history step and which replace the current one is declared once per node. To another node — or from an unknown location, so Back can still return to it — is always a step. Within a node, its history rule: a string, or a function for nodes where some param changes are entries of their own and others are views of one entry:

ts
const PersonNode = Site.route(personRouter, AppRoute.Person, {
  // Another person is another entry (a step); the default within a node is a replace.
  history: (prev, next) => (prev.personId === next.personId ? 'replace' : 'push'),
})

Site.historyOf(onePersonTarget, anotherPersonTarget) // 'push'
Site.historyOf(onePersonTarget, samePersonTarget) // 'replace'

This unifies the mirror's per-key spelling with the routed code that used to spell the same rule by hand. Mirrors keep their per-key spelling for plain fields (a search, a tab); routed params that ask an owner for something are intents (below), not mirrors — a mirror installs fields but cannot run a transition.