fix(widget-editor): SQL placeholder swap + stable preview Run button - #1193
Conversation
Two widget-editor query bugs: - QueryEditor baked the placeholder into CodeMirror at mount and never updated it, so switching a connection Neo4j → SQL kept showing the Cypher example query. Give the placeholder its own Compartment and a useEffect([placeholder]) that reconfigures it, mirroring the existing language-switch pattern. - The preview header's error icon was a third child in the justify-between row, so on query error it re-spread the row and pushed the Run button inward. Wrap the error icon + Run button in one right-aligned group so the header always has exactly two children and Run stays pinned. Regression tests added for both. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
WalkthroughThis PR contains two unrelated changes: WidgetPreviewPanel's header layout is restructured so the Run button and error tooltip share a flex container, preventing layout shift, with an accompanying test; and QueryEditor's CodeMirror placeholder is moved to a dedicated compartment for in-place reconfiguration after mount, avoiding editor recreation, with a corresponding test. ChangesWidget Preview Panel Layout
Query Editor Placeholder Reconfiguration
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|



Summary
Fixes two widget-editor query bugs reported during manual use:
SQL placeholder stuck on Cypher — switching a connection from Neo4j to SQL kept showing the Neo4j (
MATCH (n) RETURN …) example query in the editor placeholder. The placeholder was baked into CodeMirror at mount and never updated on language change. Fixed by giving the placeholder its ownCompartment+ auseEffect([placeholder])that reconfigures it in place, mirroring the existing language-switch pattern.Preview "Run" button shifts on query error — the error icon was a third child in the
justify-betweenheader row, so on error the row re-spread its items and pushed Run inward. Wrapped the error icon + Run button in a single right-aligned group so the header always has exactly two children and Run stays pinned.Changes
component/src/components/composed/query-editor.tsx— placeholder compartment + reconfigure effectapp/src/components/widget-editor/widget-preview-panel.tsx— group error icon with Run buttonTesting
query-editor29/29 (new placeholder-reconfigure regression test)widget-preview-panel11/11 (new "Run stays grouped on error" regression test)code-completion+widgetsspecs pass (4 auth-warmup flakes passed clean on single-worker re-run)Notes
A third report ("edit is Cmd+E not Cmd+N") was investigated and is a non-bug — the code already uses Cmd/Ctrl+E everywhere. The only "N" shortcut is Cmd+Shift+N (Add Widget).
🤖 Generated with Claude Code
Summary by CodeRabbit