Site / Creating a site

Attaching data: Surfaces

A node names the Surface its route activates, with the route's params made into its own:

ts
const People = Site.route(peopleRouter, AppRoute.People, {
  surface: {
    surface: PeoplePage,
    params: route => ({ searchText: route.searchText }),
  },
})

Site.sources(site, App.owner, App.model.route) is each surfaced node as its Surface.when, keyed by tag, for Data.wiring, Data.subscriptions, Data.satisfy, or an SSR plan's surfaces. Each entry answers its own tag only: on a person page the person Surface is active and the people Surface is not. A surface from another application is refused here, not at its reads. Site.sourcesFor(site, owner, place, target.route) is the same entries for the target's chain only — the route-level Sources prefetch and SSR read.