Site / Creating a site

Intents that wait for their owner

When a URL asks for an action on a lazy child whose Model has not loaded yet (such as selecting a block while the page loads), hold the pending request in the Model and apply it with followPending once the child becomes ready:

ts
const follow = followPending(EditorSlot, {
  pending: model => model.linked,
  release: model => ({ ...model, linked: Option.none() }),
  ready: (_child, model) => PageEditor.status(model) !== 'Loading',
  toMessages: (linked, _child, model) => [/* owner's Messages */],
  send: (model, message) => Option.some(stepped(model, Message.GotEditorMessage({ message }))),
})

Apply follow outside the installer that loads the child, and keep the pending field in URL-synced state so reloads preserve the intent until it runs.