fix(desktop): correct renamed file diffs and reset expanded commits on workspace switch

Merged
KI
1y ago
+31-19

Summary

  • Fix renamed files showing blank/incorrect originals in diff viewer by passing oldPath to getFileContents and using it for the "original" side lookup
  • Reset expandedCommits state when workspace changes to prevent querying old commit hashes against the new worktree

Test plan

  • Rename a file and stage it, verify the diff shows the correct original content
  • Create a commit with a renamed file, verify the committed diff shows correctly
  • Switch workspaces while commits are expanded, verify no errors from stale commit queries

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

    • Improved tracking and display support for files that have been renamed or moved in version control
  • Bug Fixes

    • Fixed an issue where stale data could persist when switching between different workspaces or projects
  • Style

    • Enhanced the visual layout and spacing of the changes view interface for improved usability

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