Skip to content

perf(status-bar): narrow the editor selector, and say what the toolbar hook is - #607

Merged
EVWorth merged 1 commit into
mainfrom
perf/statusbar-narrow-selectors
Sep 10, 2026
Merged

EVWorth merged 1 commit into
mainfrom
perf/statusbar-narrow-selectors

Conversation

@EVWorth

@EVWorth EVWorth commented Sep 10, 2026

Copy link
Copy Markdown
Owner

Closes #458, closes #448.

#458 — the selector

StatusBar read the whole tabs array and activeTabId to derive one string: the active tab's database. Every editor action rewrote that array, so a 400-line component re-rendered and reflowed its update overlay for a value that hadn't changed. The selector now derives the string itself, and a string compares by value.

Four render-count tests via Profiler. The two negative ones fail against the wide selector; the two positive ones (guarding against over-narrowing) pass either way, as they should.

#448 — a decision, not a change

The issue asked to either route every consumer through useQueryExecution or delete it as a dead abstraction. Neither, on the evidence.

The hook's comment claimed to "centralize query execution context so callers never have to thread connectionId/database manually" — which read as a general abstraction eleven features were ignoring. They weren't ignoring it; they couldn't use it. It resolves the connection and database from the selected connection and the active editor tab, which is the wrong answer for a dialog that already knows which connection it was opened for. And inlining its 64 lines into a 416-line QueryToolbar would make worse the very component #450/#451 complain about.

The centralizing that issue wanted does exist, one layer down: every statement goes through lib/run-statement.ts or resultStore.executeQuery, and nothing calls api.executeQuery directly any more (#586). The comment now says so, so the next reader doesn't re-file it.

A test-precondition note

The render-count tests seed both tabs themselves rather than leaning on the shared beforeEach. Relying on it made the precondition ambiguous — the active tab's database wasn't what the seed appeared to set — and one test failed for a reason that had nothing to do with the selector. Worth stating because I chased that for a while before checking the assumption.

Verification

Unit 1993, browser 300, 0 lint errors.

…r hook is

StatusBar read the whole `tabs` array and `activeTabId` to derive one string:
the active tab's database. Every editor action rewrote that array, so a
400-line component re-rendered and reflowed its update overlay for a value
that had not changed (#458). The selector now derives the string itself, and
a string compares by value.

Also #448, which asked for a decision rather than a change: either route
every consumer through useQueryExecution or delete it as a dead
abstraction. Neither, on the evidence.

The hook's comment claimed to "centralize query execution context so callers
never have to thread connectionId/database manually", which read as a general
abstraction eleven features were ignoring. They were not ignoring it — they
could not use it. It resolves the connection and database from the selected
connection and active *editor tab*, which is the wrong answer for a dialog
that already knows which connection it was opened for. Inlining its 64 lines
into a 416-line QueryToolbar would also make the component this audit
elsewhere complains about worse.

The centralizing that issue wanted exists one layer down: every statement now
goes through lib/run-statement.ts or resultStore.executeQuery, and nothing
calls api.executeQuery directly any more (#586). The comment now says that,
so the next reader does not re-file this.

The render-count tests seed both tabs themselves rather than leaning on the
shared beforeEach. Relying on it made the precondition ambiguous — the
active tab's database was not what the seed appeared to set — and the test
failed for a reason that had nothing to do with the selector.

Closes #458
Closes #448

Co-Authored-By: Claude Opus 5 <[email protected]>
@EVWorth
EVWorth merged commit 1316d2f into main Sep 10, 2026
12 checks passed
@EVWorth
EVWorth deleted the perf/statusbar-narrow-selectors branch September 10, 2026 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant