You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[P1][arch] editorStore.ts is a god object: 7 tab kinds share one store with growing add* methods and per-feature lifecycle #286
src/stores/editorStore.ts (366 LOC) owns query|structure|admin|routine|compare|designer tab kinds, with one add*Tab method per kind that each dedup their own open-tab check. New tab kinds keep adding methods.
Problem
Any new feature adding a tab kind results in: a new union member, a new add* method with the same dedup shape, and a new lifecycle block. The store crosses feature boundaries (editor + structure + admin + routine + compare + designer). God object. Also drags the cross-cutting concern out: see batch 6 cross-cutting pass.
Files
src/stores/editorStore.ts:1-366
src/components/editor/EditorTabs.tsx (consumer of the god store)
Repro
Adding an "ERD" tab kind would require a union member + addErdTab method + dedup logic, in a 400-LOC store that already mixes 6 features.
Expected
A generic useTabRegistry<Kind, State> (or per-feature slices under a root store) where each feature registers its tab kind and dedup rule without bloating editorStore.
Proposed fix
Scope L. Split editorStore by tab kind: queryTabs, structureTabs, etc., each owning its dedup. Or: introduce a tabs slice with a TabKind registry where features register kinds. Cross-cutting pass (batch 6) handles the structural redesign.
Acceptance
editorStore.ts LOC drops to <200; adding a new tab kind requires editing at most the corresponding feature slice + the type union.
Activity
refactor(editor): make a tab kind data rather than another method
refactor(editor): make a tab kind data rather than another method (#648)