fix: single-click on sidebar table only toggles columns, not a new tab (#54)#178
Conversation
#54) Single-clicking a table in the schema browser used to both expand/collapse its column list and open (or switch to) a SELECT query tab, navigating users away from unsaved work just for wanting to peek at column names. Single-click now only toggles the column list. Opening a query tab is a deliberate action: double-click the table, or pick "Query table" from the right-click context menu (both call the existing onTableSelect path, so the dedupe-by-(schema,table) and PK-aware template behaviour is unchanged). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@claude review this PR |
|
Claude finished @eugene-mobile's task in 1m 40s —— View job PR Review
Overall: Looks good — clean, well-scoped fix. The change is small and the PR description is unusually thorough in explaining trade-offs. A few observations below. What works well
Minor observations1. Comment verbosity ( The 4-line block comment is more than this codebase's style needs. The "why" is that single-click used to steal focus — one line with the issue reference covers it: // Expand/collapse only — opening a query tab is deliberate (double-click or ctx menu). See #54.
onClick={() => toggleTable(table.name)}2. Double-click toggle flicker (acknowledged, trade-off accepted) The PR description correctly notes that 3. Before this change, single-clicking highlighted the row ( No blocking issues. The double-click flicker and discoverability trade-offs are called out honestly in the PR description. The comment verbosity is the only thing worth tightening before merge. |
Problem
Closes #54. Single-clicking a table name in the schema browser both expanded/collapsed its column list and opened (or switched to) a
SELECT * FROM table LIMIT 100;query tab. Users who just wanted to peek at column names were unintentionally navigated away from their current editor work.Fix
In
SchemaBrowser.tsx, the table row's click handling is split:toggleTable). It no longer touches the active tab oronTableSelect.onTableSelect), the deliberate action.onTableSelectpath, for discoverability.The hover tooltip now hints "double-click to query".
onTableSelectitself is unchanged, so the existing behaviour it drives is preserved: dedupe by(schema, table)so re-querying a table reuses its tab, and the PK-awareSELECTtemplate (descending sort only for a single auto-increment PK).Notes
onClicks (toggle → toggle) beforeonDoubleClick, so expansion nets to its prior state while the tab opens — the standard tree-view trade-off, visually negligible..test.ts) and no existing SchemaBrowser tests. The change is pure handler rewiring; typecheck, lint, and the production build pass, and the existing 76 client tests are green.🤖 Generated with Claude Code