SSR / foldkit-ssr

Checking what the browser will read

The view check sees what the first render shows. A Surface can read a field the first view never shows: a like button's state, a menu's contents. Name the Surfaces the browser may activate, and the fields that may start from the baseline on purpose:

ts
const Post = SSR.plan(App, {
  id: 'post',
  state: Projection.pick(App.model.route, App.model.post.id, App.model.post.liked),
  local: [App.model.menuOpen], // starts from the baseline, on purpose
  surfaces: [
    Surface.when(PostActions, App.model.route, AppRoute.Post, route => ({ id: route.id })),
    Surface.at(Menu, undefined),
  ],
})

SSR.render then refuses the plan, naming the Surface and the field, when an active Surface reads a field that is in neither state nor local, is activated by one, reads data no part of the plan resumes, or would activate differently from the Model the browser starts from. The check runs for the server's Model, because a Surface's reads follow its params. SSR.inspect(plan, model) returns the same findings as data, for a test or a debugging session: for each Surface, whether it is active, and where each read comes from, state, local or missing.

A Surface.each family is one entry of surfaces: the envelope carries its parent's reads with its instances', and coverage inspects each instance by key (Member[u1]), saying which parent reveals it, so a gap names the instance.