refactor(workbench): split editor state and components
This commit is contained in:
1 parent
caa3cb843f
commit
834470cfa1
23 files changed
+1219
-878
No files matched your search
@@ -1,3 +1,12 @@
|
||||
# State Management
|
||||
|
||||
Use component `useState` for server state, selection, staged overrides, layer visibility and UI filters. `src/lib/api.ts` is the sole browser HTTP boundary. Keep staged overrides separate from persisted `WorkbenchState.overrides`; save them before compile.
|
||||
Use component `useState` for server state, selection, layer visibility and UI filters. Domain hooks own their draft state: ordinary v1 staged overrides remain separate from persisted `WorkbenchState.overrides`; v2 constraints remain inside `EditSession`; signal drafts remain separate until the signal save step.
|
||||
|
||||
`src/lib/api.ts` is the sole browser HTTP boundary. Presentational components never call it directly. `App` coordinates the fixed save order: ordinary v1 overrides, v2 document, signal draft, then compile and replace server state.
|
||||
|
||||
Whenever App accepts a fresh server `WorkbenchState` (initial load, import, compile,
|
||||
signal generation, or an accepted junction candidate), it must also refresh the
|
||||
signal draft's saved baseline. Otherwise discard can restore an older signal geometry
|
||||
after a later rotation or move.
|
||||
|
||||
Do not duplicate the whole `WorkbenchState` in multiple hooks. Hooks may use `setState` to update their owned slice and refs for non-serializable history, but there must be one current server state and one owner for each undo/redo stack. `lane-maneuver` belongs exclusively to v2 direct edit; it must not re-enter the v1 staged array.
|
||||
Reference in new issue
Block a user