Repository navigation
perf(status-bar): narrow the editor selector, and say what the toolbar hook is - #607
Merged
Merged
Conversation
…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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #458, closes #448.
#458 — the selector
StatusBarread the wholetabsarray andactiveTabIdto 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
useQueryExecutionor 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
QueryToolbarwould 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.tsorresultStore.executeQuery, and nothing callsapi.executeQuerydirectly 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.