ADR-0004 · One client store per document drives every component
Status: Accepted, 2026-10-10.
Context
Three components each fetched the same document state and invented their own error handling, so a page could show three different stories at once.
Decision
getRedlineStore keeps one store per service, site and document on the page.
It owns the state machine (static, probing, live, connect-required and the
failure states), dedupes loads, starts at most one per five seconds unless
forced, and bypasses the HTTP cache. Components subscribe and render; none
fetches the state itself.
Why
One request and one answer per page; every component reports the same state
with the same message from REDLINE_MESSAGES.
Consequences
Writes go through createRedlineClient and then force a store reload. The
cache bypass exists because anonymous state is publicly cacheable (TD-005).
Evidence
c980877, 8cdd08a, 26164e9; test/client-store.test.js.
Revisit when
A component needs data the document state does not carry, or pages host several documents.