Skip to content

refactor(editor): make a tab kind data rather than another method (#286) - #648

Merged
EVWorth merged 1 commit into
mainfrom
refactor/editor-tab-kinds
Sep 11, 2026
Merged

EVWorth merged 1 commit into
mainfrom
refactor/editor-tab-kinds

Conversation

@EVWorth

@EVWorth EVWorth commented Sep 11, 2026

Copy link
Copy Markdown
Owner

Stacked on #647.

editorStore had one add*Tab method per kind, each ~30 lines repeating the same shape: look for an open tab with the same identity, activate it if found, otherwise build one and append. Adding a kind meant a union member, a method, a dedup block and a title rule, scattered through a 437-line store spanning six features.

A kind is now three answers — what identifies a tab of this kind, what it's called, and what fields it carries — and the store has one openTab that uses them. The five methods remain as named arguments over it, so no caller changed; the thirty lines behind each are gone.

The session persistence went with it: the parser, the reader, the writer and the tab-counter recovery aren't state, and they were the other half of the store's length.

211 lines, from 437. TAB_KINDS is exported so a test fails when a kind is added without a spec, rather than the kind silently never deduping.

Two things the tests pinned down that the old methods only implied

  • A designer tab opened with "" for a table name and one opened with nothing are the same new table — treating them as different opened a second designer for the same thing.
  • A designer tab must not be mistaken for a structure tab, which carries the same three fields.

2660 unit + 341 browser tests, all passing unchanged through the refactor. 31 new tests on the registry.

Closes #286

🤖 Generated with Claude Code

@EVWorth
EVWorth force-pushed the fix/sql-quote-escaping branch from 5fe2136 to dbd55b4 Compare September 11, 2026 23:46
Base automatically changed from fix/sql-quote-escaping to main September 11, 2026 23:50
`editorStore` had one `add*Tab` method per kind, each about thirty lines
repeating the same shape: look for an open tab with the same identity,
activate it if found, otherwise build one and append. Adding a kind meant a
union member, a method, a dedup block and a title rule, scattered through a
437-line store that spanned six features (#286).

A kind is now three answers — what identifies a tab of this kind, what it is
called, and what fields it carries — and the store has one `openTab` that uses
them. The five methods remain as named arguments over it, so no caller
changed; the thirty lines behind each are gone.

The session persistence went with it. The parser, the reader, the writer and
the tab-counter recovery are not state, and they were the other half of the
store's length.

211 lines, from 437. `TAB_KINDS` is exported so a test fails when a kind is
added without a spec, rather than the kind silently never deduping.

Two things the tests pinned down that the old methods only implied: a designer
tab opened with `""` for a table name and one opened with nothing are the same
new table — treating them as different opened a second designer for the same
thing — and a designer tab must not be mistaken for a structure tab, which
carries the same three fields.

Co-Authored-By: Claude Opus 5 <[email protected]>
@EVWorth
EVWorth force-pushed the refactor/editor-tab-kinds branch from 5301c9c to d4d2f16 Compare September 11, 2026 23:50
@EVWorth
EVWorth merged commit 057cbba into main Sep 11, 2026
12 checks passed
@EVWorth
EVWorth deleted the refactor/editor-tab-kinds branch September 11, 2026 23:54
@EVWorth EVWorth mentioned this pull request Sep 12, 2026
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P1][arch] editorStore.ts is a god object: 7 tab kinds share one store with growing add* methods and per-feature lifecycle

1 participant