Skip to content

feat(desktop): swap changes-sidebar clicks to open file, cmd-click for diff - #5979

Merged
AviPeltz merged 1 commit into
mainfrom
swap-changes-click
Jul 27, 2026
Merged

AviPeltz merged 1 commit into
mainfrom
swap-changes-click

Conversation

@AviPeltz

@AviPeltz AviPeltz commented Jul 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Swaps the click behavior on changed-file rows in the v2 changes sidebar: a plain click now opens the rendered file, and cmd/ctrl-click opens the diff view (previously the reverse).

The sidebarFileLinks preference stores generic actions (pane/newTab/external) per modifier tier; the diff-vs-file semantic for the changes sidebar is resolved in changesSidebarFilePolicy.intentFor, so the swap is a one-line flip there and propagates to both sidebar renderers (list + tree), tooltip hints, and menu shortcut chips — including for users with an already-persisted preference. Shift-click (diff in new tab) and cmd+shift-click (external editor) are unchanged.

Also moves the ⌘ shortcut chip in the row context/dropdown menus from "Open File" to "Open Diff", since "file" is now the plain-click action and never sits on a modifier tier.

The v1 legacy changes sidebar (screens/main/.../FileItem.tsx) has its own hardcoded handling and is intentionally untouched.

Test Plan

  • bun test changesSidebarFilePolicy.test.ts — updated expectations pass (plain → file, ⌘ → diff, tier lookups)
  • bun run lint clean
  • bun run typecheck (apps/desktop) clean
  • Manual: click a changed file in the sidebar → rendered file opens; ⌘-click → diff opens; menu chips show ⌘ on "Open Diff"

https://claude.ai/code/session_01DiEVMcd9RDKJz9vPGD3ojY


Open in Stage

Summary by cubic

Swapped click behavior in the v2 Changes sidebar: plain click now opens the file, and Cmd/Ctrl-click opens the diff. Existing sidebarFileLinks preferences still apply; tooltips and menu shortcut chips are updated; shift-modifier actions are unchanged; the legacy v1 sidebar is not affected.

Written for commit ab794e5. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes
    • Updated Changes sidebar click behavior so regular clicks open files, while modifier-clicks open diffs.
    • Corrected shortcut hints to appear on “Open Diff” actions instead of “Open File.”
    • Updated context menu behavior and shortcut mappings for consistent file and diff actions.

@ghost

ghost commented Jul 27, 2026

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 2 individual chapters for you:

Title
1 Swap click behavior in sidebar file policy
2 Update UI shortcut chips in sidebar components
Open in Stage

Chapters generated by Stage for commit ab794e5 on Jul 27, 2026 3:16am UTC.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c71f9cdd-69d5-4375-8a27-ef6e17ea0064

📥 Commits

Reviewing files that changed from the base of the PR and between 129021f and ab794e5.

📒 Files selected for processing (4)
  • apps/desktop/src/renderer/lib/clickPolicy/policies/changesSidebarFilePolicy.test.ts
  • apps/desktop/src/renderer/lib/clickPolicy/policies/changesSidebarFilePolicy.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/ChangesTreeView/components/FileRowContextMenuItems/FileRowContextMenuItems.tsx
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/FileRow/FileRow.tsx

📝 Walkthrough

Walkthrough

The changes sidebar now resolves plain clicks to file intents and modifier clicks to diff intents. File-row dropdown and context-menu shortcuts are derived from the diff tier, while Open File shortcut labels are removed.

Changes

Changes sidebar intent and shortcut alignment

Layer / File(s) Summary
Policy intent resolution and tests
apps/desktop/src/renderer/lib/clickPolicy/policies/changesSidebarFilePolicy.ts, apps/desktop/src/renderer/lib/clickPolicy/policies/changesSidebarFilePolicy.test.ts
Plain clicks resolve to file, modifier clicks resolve to diff, and tier lookup expectations are updated.
Diff shortcut rendering
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/hooks/useChangesTab/components/ChangesFileList/components/.../FileRow*
Open Diff menu entries use the diff tier for shortcut labels; Open File entries no longer display file-tier shortcut labels.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: kitenite

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise, conventional, and accurately summarizes the main sidebar click-behavior swap.
Description check ✅ Passed The description covers the change and testing well, though the checklist section is not fully completed in template form.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch swap-changes-click

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.

@AviPeltz
AviPeltz merged commit 954050c into main Jul 27, 2026
10 of 11 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch

Thank you for your contribution! 🎉

AviPeltz added a commit that referenced this pull request Jul 30, 2026
…6062)

Reverts 954050c (#5979): plain click opens the diff again, cmd/ctrl-click opens the file.
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