Site / Creating a site

Stateful pages: one placement

Site.placement states one routed page once — its link, what starts it, and what its route arrival tells it — so the fold and the drawing never restate the field, the wrapper, or the slot:

ts
const PeoplePage = Site.placement(PeopleNode, PeopleBundle, {
  link: Link.field<Model>()('peoplePage', Link.wrapper(Message.GotPeopleMessage)),
  args: parent => ({
    searchText: parent.route._tag === 'People' ? parent.route.searchText : Option.none(),
  }),
  changed: route => People.Message.ChangedRoute({ route }),
})

placed.update folds the child's Messages and placed.view draws it. changed receives the node's own case value when its route arrives and returns the child's Message — or nothing when the arrival needs no answer. Bundles with OutMessages, and children that are not Bundles, stay on Bundle.at and Link.child directly.