Skip to content

feat(desktop): improve side-by-side diff view UI and fix content reset#836

Merged
Kitenite merged 2 commits into
mainfrom
side-by-side-diff
Jan 19, 2026
Merged

feat(desktop): improve side-by-side diff view UI and fix content reset#836
Kitenite merged 2 commits into
mainfrom
side-by-side-diff

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Jan 19, 2026

Summary

  • Simplify diff view mode toggle to a single button that switches between inline and side-by-side modes
  • Fix diff content baseline update to trigger when any diff data exists (not just when modified content exists)
  • Reset diff content refs when navigating to a different file to prevent stale content
  • Update close button hover styles from destructive to primary color

Test plan

  • Open a file with diff view and toggle between inline and side-by-side modes
  • Navigate between different files and verify diff content updates correctly
  • Verify close buttons in ports list show primary color on hover

Summary by CodeRabbit

Release Notes

  • New Features

    • Added toggle to switch between side-by-side and inline diff view modes in the file viewer toolbar.
    • Added expand and close controls to the sidebar header.
  • Improvements

    • Enhanced diff viewer to properly refresh when file path or view mode changes.
  • Style

    • Updated hover text colors for close button controls.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 19, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The changes implement a new diff view mode toggle system allowing users to switch between side-by-side and inline diff views in the file viewer. Additionally, UI controls for expanding and closing the changes sidebar are added, along with styling updates to port-related components and improved diff editor mounting behavior.

Changes

Cohort / File(s) Summary
Port Component Styling
MergedPortBadge.tsx, WorkspacePortGroup.tsx
Updated hover text color from text-destructive to text-primary on close buttons (cosmetic styling change)
Diff Editor Enhancement
DiffViewer.tsx
Added dynamic key to force remount on filePath or viewMode changes; injected useInlineViewWhenSpaceIsLimited: false option to override inline view behavior
Diff View Mode System
FileViewerPane.tsx, FileViewerContent.tsx, FileViewerToolbar.tsx
Removed showEditableBadge logic and wired useChangesStore to enable diffViewMode control; introduced new diffViewMode prop threaded through component hierarchy; added diff view toggle UI in toolbar to switch between side-by-side and inline views
File Content Hook
useFileContent.ts
Changed conditional from diffData?.modified && !isDirty to diffData && !isDirty, removing explicit check for modified property existence
Sidebar UI Controls
ChangesHeader.tsx
Added expand and close sidebar buttons with tooltips; integrated useSidebarStore to enable sidebar toggling

Sequence Diagram

sequenceDiagram
    actor User
    participant FileViewerToolbar
    participant FileViewerPane
    participant FileViewerContent
    participant DiffViewer
    participant useChangesStore

    User->>FileViewerToolbar: Click diff view mode toggle
    FileViewerToolbar->>FileViewerPane: onDiffViewModeChange(newMode)
    FileViewerPane->>useChangesStore: setDiffViewMode(newMode)
    useChangesStore-->>FileViewerPane: Store updated
    FileViewerPane->>FileViewerContent: diffViewMode prop updated
    FileViewerContent->>DiffViewer: viewMode={diffViewMode}
    DiffViewer-->>DiffViewer: Dynamic key triggers remount
    DiffViewer-->>User: Renders with new diff layout
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 The diff view dances left and right,
Side-by-side or inline, what a sight!
Toggles flow through components with care,
While sidebars expand into the air,
Port badges now blush a calming hue,
ding! Another control flow breakthrough! ✨

✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

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

@Kitenite Kitenite merged commit 5884bb4 into main Jan 19, 2026
3 of 5 checks passed
@Kitenite Kitenite deleted the side-by-side-diff branch January 19, 2026 21:35
@github-actions
Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ⚠️ Neon database branch
  • ⚠️ Electric Fly.io app

Thank you for your contribution! 🎉

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.

1 participant