Skip to content

Commit 7efb484

Browse files
committed
Document reactive signals as available utility in coding standards
Not wired into the UI yet — the derive/plan pattern covers current needs. Documented as ready for adoption when the UI layer grows enough to benefit from declarative bindings.
1 parent fadd1ac commit 7efb484

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

docs/CODING_STANDARDS.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,26 @@ State belongs to the coordinator that manages its lifecycle, and is passed by re
231231

232232
- **GameState** is owned by `GameClient`, updated via `applyGameState()`. Other modules receive it as function arguments, never as stored references.
233233

234+
### Reactive signals (available, not yet adopted)
235+
236+
`src/client/reactive.ts` is a zero-dependency signals library
237+
(~150 LOC) providing `signal`, `computed`, `effect`, `batch`,
238+
and DOM helpers (`bindText`, `bindClass`). It has full lifecycle
239+
management — nested effects auto-dispose on parent re-run,
240+
computed exposes `dispose()` — and 31 tests including
241+
property-based coverage.
242+
243+
The library is **not currently wired into the UI**. The
244+
existing derive/plan pattern handles current needs well. Use
245+
reactive signals when the UI layer grows to a point where
246+
manual DOM-sync boilerplate becomes a drag — e.g. settings
247+
panels, lobby state, or rich interactive overlays where
248+
declarative bindings would reduce wiring code.
249+
250+
Known trade-off: diamond dependencies can emit intermediate
251+
states outside of `batch()`. Always wrap multi-signal updates
252+
in `batch()` when they feed the same computed or effect.
253+
234254
### Dependency injection
235255

236256
Client game modules use two patterns depending on purity (see [dependency injection](https://en.wikipedia.org/wiki/Dependency_injection)):

0 commit comments

Comments
 (0)