mirror of
https://github.com/olehomelchenko/astrolabe.git
synced 2026-08-08 02:02:33 +00:00
Document persistence failure-surfacing and overlay-store conventions
This commit is contained in:
@@ -162,6 +162,20 @@ Each cohesive feature owns a store holding its durable domain state.
|
||||
- **`useSettingsStore`** — user preferences (editor options, render debounce,
|
||||
date format, theme); mirrors what gets persisted to `localStorage`.
|
||||
|
||||
### Global overlay stores (imperative trigger)
|
||||
|
||||
Some surfaces are summoned from anywhere — including non-React code — and own only
|
||||
ephemeral request state, not durable data:
|
||||
|
||||
- **`useConfirmStore`** — the blocking confirm dialog (the `window.confirm` replacement).
|
||||
- **`useNotificationStore`** — non-blocking toasts (failed saves, etc.).
|
||||
|
||||
Each pairs its store with a thin **imperative trigger** exported alongside the hook —
|
||||
`confirm(opts): Promise<boolean>` and `notify(opts): string` — so orchestration/services can
|
||||
raise one without a hook: `export const notify = (o) => useNotificationStore.getState().notify(o)`.
|
||||
Components subscribe to the store to _render_ it; everyone else calls the function. (Why a
|
||||
toast at all, and which channel for which message: [10 · Interaction & Feedback](10-interaction-and-feedback.md) §1.)
|
||||
|
||||
### The central `useAppStore`
|
||||
|
||||
`useAppStore` holds only _cross-cutting, ephemeral UI state_ that no single
|
||||
|
||||
Reference in New Issue
Block a user