Skip to content

fix: replace .inspector() with custom panel to fix jittery animation#253

Merged
datlechin merged 2 commits intomainfrom
fix/right-sidebar-animation-jitter
Mar 10, 2026
Merged

fix: replace .inspector() with custom panel to fix jittery animation#253
datlechin merged 2 commits intomainfrom
fix/right-sidebar-animation-jitter

Conversation

@datlechin
Copy link
Copy Markdown
Collaborator

@datlechin datlechin commented Mar 10, 2026

Summary

  • Replaced SwiftUI's .inspector() modifier with a custom HStack + .transition(.move(edge: .trailing)) panel for the right sidebar
  • The .inspector() modifier uses an internal NSSplitViewController whose constraint-based animation becomes expensive at tight window widths, causing visible jitter/lag
  • The custom approach uses SwiftUI's lightweight animation system, which only animates a single view insertion/removal without split view constraint solving

Closes #243

Test plan

  • Open a connection and toggle the right sidebar (⌘⌥B) at various window sizes
  • Verify animation is smooth at both small and large window widths
  • Verify the inspector content (Details tab, AI Chat tab) still renders correctly
  • Verify the inspector panel width is consistent (~320pt)

Summary by CodeRabbit

  • New Features

    • Right panel is now resizable via a draggable handle
    • Panel width preferences are automatically saved and restored
  • Improvements

    • Enhanced right panel layout and animation behavior for smoother user interactions

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 10, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

The right sidebar is restructured from an inspector-based approach to a discrete, animated pane within the NavigationSplitView. Panel width persistence via UserDefaults is added, along with a new interactive PanelResizeHandle component for drag-to-resize functionality. Frame constraints are adjusted to use flexible widths with explicit animation binding.

Changes

Cohort / File(s) Summary
Right Panel Layout Restructuring
TablePro/ContentView.swift
Reorganized the detail area to use HStack with conditional rendering of right panel. Replaced inspector-based approach with discrete pane containing PanelResizeHandle, Divider, and UnifiedRightPanelView. Added explicit animation binding to rightPanelState.isPresented. MainContentView now uses flexible maxWidth instead of fixed constraints.
Panel State Persistence
TablePro/Models/UI/RightPanelState.swift
Added panelWidth property with UserDefaults persistence and clamping logic. Introduced width constants (minWidth, maxWidth, defaultWidth). Panel width is loaded on initialization, clamped to allowed range, and persists on every change via didSet observer.
Resize Handle Component
TablePro/Views/Components/PanelResizeHandle.swift
New interactive view component providing draggable resize functionality. Handles drag gestures to update bound panelWidth within RightPanelState bounds. Displays invisible 5-point-wide handle with hover cursor feedback and drag state tracking.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 The sidebar dances smooth and bright,
No more jitter, no more fright!
A handle to grasp, a pane that glides,
With UserDefaults keeping our guide,
Animation flows where it should be,
Oh, what a sight for all to see! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly describes the main change: replacing .inspector() with a custom panel to fix animation jitter, which aligns with the primary objective of the changeset.
Linked Issues check ✅ Passed The code changes directly address issue #243 by replacing the jittery .inspector() with a custom HStack-based panel and transition animation, eliminating the constraint-based animation bottleneck.
Out of Scope Changes check ✅ Passed All changes are scope-appropriate: UI restructuring to fix animation jitter, RightPanelState enhancements for width persistence, and the new PanelResizeHandle component.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/right-sidebar-animation-jitter

Comment @coderabbitai help to get the list of available commands and usage tips.

…animation

The .inspector() modifier uses an internal NSSplitViewController whose
constraint-based animation becomes expensive at tight window widths.
Replace with a lightweight HStack + transition panel that includes a
drag-to-resize handle and persists the user's preferred width.

Closes #243
@datlechin datlechin merged commit c5ef34e into main Mar 10, 2026
2 of 3 checks passed
@datlechin datlechin deleted the fix/right-sidebar-animation-jitter branch March 10, 2026 10:08
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.

bug: Right sidebar animation is jittery

1 participant