Skip to content

feat(datagrid): resizable JSON field in the row details inspector#1850

Merged
datlechin merged 2 commits into
mainfrom
fix/resizable-json-detail-field
Jul 10, 2026
Merged

feat(datagrid): resizable JSON field in the row details inspector#1850
datlechin merged 2 commits into
mainfrom
fix/resizable-json-detail-field

Conversation

@datlechin

Copy link
Copy Markdown
Member

Closes #1849.

Problem

The row details inspector showed JSON values in a fixed field capped at about 3 lines (JsonEditorView pinned .frame(minHeight: 80, maxHeight: 120), and the code editor is greedy so it always sat at the 120px cap). To read more you had to click Expand or Open in Window. There was no way to make the field taller inline, and nothing was remembered.

Change

The JSON field in the inspector is now resizable. Drag the handle below it to make it taller, up to a sensible cap. The height is stored in @AppStorage and applies to every JSON field, so it survives moving between rows and app restarts.

  • ResizableFieldMetrics (new): pure, unit-tested clamp helper plus the JSON height range (80 to 600) and default (120, matching the current look).
  • ResizableEditorContainer (new): reusable view that renders content at a bound height with a thin bottom drag handle. Uses DragGesture with @GestureState for the live delta, commits the clamped height on end, and shows NSCursor.resizeUpDown on hover (the same cursor pattern used in ERDiagramView).
  • JsonEditorView: wraps the editor in the container and stores the height in @AppStorage("rightSidebar.jsonFieldHeight"). The editor's SourceEditorState/SourceEditorConfiguration are untouched on resize, so marked text (IME), the undo stack, and focus are preserved. The existing Expand and Open in Window buttons stay as the keyboard/VoiceOver path and the very-large-value escape hatch.

Why @AppStorage

The inspector's List/ForEach re-creates JsonEditorView for each selected row, so a plain @State height would reset every time you change rows, which is the reset the issue calls out. @AppStorage re-reads the stored value on each re-creation, so the height persists across rows and launches. One shared value means multiple JSON columns resize together, matching the single resizable value area in DataGrip and DBeaver.

Native basis

There is no per-view resize affordance to reuse: .resizable() is Image-only, .pointerStyle(.frameResize:) is macOS 15+ and we target 14, and NSSplitView is the wrong granularity for one row in a scrolling list. This follows Apple's split-view divider idiom (thin handle, min and max clamps) with a DragGesture scoped to a thin bottom strip so it does not fight the list's scroll or the text view's own mouse handling.

Tests

ResizableFieldMetricsTests covers the clamp: within range, at both bounds, and default-in-range. Verified locally with a standalone swiftc run (6/6 pass). The full xcodebuild test was not run here; please confirm on CI.

Docs / CHANGELOG

  • docs/features/data-grid.mdx: the Cell Inspector section notes the resizable, persisted JSON field.
  • CHANGELOG.md: Added entry under [Unreleased].

@mintlify

mintlify Bot commented Jul 10, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
TablePro 🟢 Ready View Preview Jul 10, 2026, 7:52 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@datlechin datlechin merged commit ad20b3a into main Jul 10, 2026
1 of 2 checks passed
@datlechin datlechin deleted the fix/resizable-json-detail-field branch July 10, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make JSON fields resizable on the details sidebar

1 participant