Skip to content

feat: editable prettified DML preview + live split-pane snapshots - #21

Closed
broisnees wants to merge 2 commits into
masterfrom
feat/dml-editor-pane-snapshot
Closed

broisnees wants to merge 2 commits into
masterfrom
feat/dml-editor-pane-snapshot

Conversation

@broisnees

Copy link
Copy Markdown
Collaborator

Addresses three requests around the Review changes dialog and the split-pane defocus view.

1. Review changes dialog is now editable + prettified

  • The generated SQL is prettified with sql-formatter (already a dependency) and shown in an editable Monaco editor (lazy-loaded, so Monaco stays out of the plain table-browsing bundle) instead of the previous cramped, wrapping read-only block. Shiki renders an instant highlighted preview while Monaco mounts.
  • Editing the SQL switches Apply to run the text verbatim via executeSqlMulti + a page refetch (new onexecutesql prop wired to handleExecuteRawDml in StudioShell). If you don't touch it, Apply still uses the safe structured per-cell writes (onsave/ondelete/oninsertrow) so the parameterized path is unchanged for the common case. An amber hint + a "Reset SQL" affordance make the edited state clear. ⌘/Ctrl+Enter applies.

2. Added row was missing from the DML

When a pending inline new-row draft coexists with staged edits/deletes, applying them only built the UPDATE/DELETE statements — the INSERT was dropped. The combined review now includes the INSERT (rendered last so existing row indices stay valid) and executes it.

3. Defocused split panes show real content

A defocused SQL / Query Editor pane rendered a generic "Click this pane to focus it" placeholder. PaneSnapshot now renders the pane's query text + last results (read-only), matching how table panes already snapshot their grid.

Files

  • src/lib/components/DataTable.svelte — editable/prettified preview, raw-exec branch, insert-in-review
  • src/lib/components/StudioShell.svelte — handleExecuteRawDml, wire onexecutesql
  • src/lib/components/PaneSnapshot.svelte — SQL tab snapshot

Verification

npm run build passes. Runtime not exercised here (Tauri app needs a live DB connection) — worth a manual pass on: editing then applying SQL, applying edits+delete+new-row together, and defocusing a Query Editor pane in a split.

Note

Separate from #20 (sidebar scroll perf); disjoint files.

Review changes dialog (DataTable):
- Prettify the generated SQL with sql-formatter and render it in an
  editable Monaco editor (lazy-loaded) instead of a cramped read-only
  block. Editing the SQL switches Apply to run it verbatim via
  executeSqlMulti + refetch (onexecutesql), while the unedited path
  keeps the safe structured per-cell writes.
- Include a pending inline new-row INSERT in the combined review +
  execution, so an added row is no longer silently dropped when
  applying edits/deletes together.

Split panes (PaneSnapshot):
- A defocused SQL/Query Editor pane now renders its query text and last
  results (read-only) instead of the generic 'click to focus'
  placeholder.
@changeset-bot

changeset-bot Bot commented Jul 5, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: f20a688

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Replace the native <select> elements in the cell editor (enum) and the
new-row draft (enum + boolean) with the app's bits-ui Select. The native
OS popup was unstyled (white box clashing with the dark theme) and broke
on Linux/WebKitGTK. The enum cell editor auto-opens on edit and commits
on pick; Escape/click-away cancels.
@broisnees

Copy link
Copy Markdown
Collaborator Author

Added a commit: replaced the native <select> dropdowns (cell-editor enum + new-row enum/boolean) with the app's themed bits-ui Select. The native OS popup was unstyled (white box against the dark theme) and broke on Linux/WebKitGTK — the screenshot showed this. The enum cell editor now auto-opens on edit and commits on pick; Escape/click-away cancels. Folded into this PR since it shares DataTable.svelte (avoids a conflicting parallel PR).

@broisnees

Copy link
Copy Markdown
Collaborator Author

Superseded by combined minor-release PR #36 (same changes, rolled up). Closing to keep a single merge.

@broisnees broisnees closed this Jul 5, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant