Docs: move point-in-time records to exploration/, trim build-narration, lift open items to plan

This commit is contained in:
2026-06-14 23:58:06 +03:00
parent de9dbf3ec8
commit 66c123e15e
16 changed files with 77 additions and 68 deletions
+7 -32
View File
@@ -30,12 +30,9 @@ A store is a module that calls `create<State>()` once and exports the resulting
hook. The state object holds both **data fields** and **action functions**.
```ts
// src/app/stores/AppStore.ts
import { create } from 'zustand';
import type { UiTheme } from '@core/theme'; // defined in core; charts key off it too
export type ModalName = 'datasets' | 'about' | 'donate' | 'chartBuilder' | 'extract';
// ModalName is the union of the app's modal identifiers; UiTheme is defined in core.
export interface AppState {
uiTheme: UiTheme;
activeModal: ModalName | null;
@@ -297,36 +294,17 @@ export const useSnippetStore = create<SnippetState>((set, get) => ({
}));
```
The component is thin — it selects state and calls actions:
The component is thin — it selects state narrowly and wires events to actions, with no
mutation logic of its own:
```tsx
import { useShallow } from 'zustand/react/shallow';
import { useSnippetStore } from '../stores/SnippetStore';
export function SnippetList() {
const { snippets, activeSnippetId } = useSnippetStore(
useShallow((s) => ({ snippets: s.snippets, activeSnippetId: s.activeSnippetId })),
);
const select = useSnippetStore((s) => s.select);
const select = useSnippetStore((s) => s.select); // stable identity — select actions individually
const remove = useSnippetStore((s) => s.remove);
return (
<ul>
{snippets.map((s) => (
<li key={s.id} aria-current={s.id === activeSnippetId} onClick={() => select(s.id)}>
{s.name}
<button
onClick={(e) => {
e.stopPropagation();
remove(s.id);
}}
>
</button>
</li>
))}
</ul>
);
// render: one row per snippet, each calling select(id) / remove(id) on the events.
}
```
@@ -508,11 +486,8 @@ couples every intermediate component to data it doesn't use.
Each store exposes a `reset()` action that returns its fields to initial values
(used on "new workspace", sign-out, or test teardown). Because every fact is a
single source field with no hand-maintained duplicates, reset is a flat `set(...)`
of the initial values; selector-derived values recompute on their own.
```ts
reset: () => set({ snippets: [], activeSnippetId: null, draftSpec: '' });
```
of the initial values (as in `SnippetStore` above); selector-derived values
recompute on their own.
---