Expand description
Where a component renders — the Mode A / Mode B decision, and what it costs to be wrong.
docs/05-tier-lowering.md §5.1 gives two rendering
modes over one source:
| Mode A — thin | Mode B — local | |
|---|---|---|
view runs on | server | client |
| Wire carries | DOM patches | data patches (state diffs) |
| Optimistic UI | no | yes — the same fold runs locally, reconciled by seq |
The row that decides everything is the second one. Mode A sends the browser a rendering of the state; Mode B sends it the state. Everything below follows from taking that literally.
§The rule: a Mode B page may not be a function of who is asking
A view has the shape (state, session) -> Html. If it reads the session, it renders a
different page for different actors from the same state — which is to say it is filtering,
scoping or hiding by identity. Running that view on the client requires giving the client the
state it filters, so every actor receives what the filter was removing. The page would still
look right. That is the worst kind of wrong.
So a component whose view is per-session is refused Mode B, and the refusal names the reason
rather than a rule. What is left is exactly the class §5.1 and
docs/10-decisions.md D5 describe as Mode B’s: pages
that are the same function of the same state for everybody — editors, typeaheads, drag-and-drop,
anything single-user or public.
This is a placement rule and not a lint: it is decided from the slicer’s own account of the
view (crate::split::Roles::view_is_per_session), which is the same fact §3.8’s fanout
analysis reads, so a program cannot be per-session for one of them and not the other.
§Optimism is a property of what crosses, not of a component
“The browser applies the expected event to its local copy speculatively — legitimate because it runs the same pure fold the server runs” (D5). That is only available to a client that holds the value the fold is of. A client holding a projection — a session’s filtered list, say — could not apply an event to it without a second, different fold that no program writes. So optimism is not an extra feature layered on Mode B; it is the same fact stated twice, and this module reports it as one decision with two consequences.
Structs§
- Decision
- How one component renders, and what follows from it.
Enums§
- Mode
- Where a component’s
viewruns. - NoOptimism
- Why a Mode B client may not guess.
- Why
- Why a component renders where it does.