Skip to content

refactor(desktop): remove auto-open first file when opening changes tab#1427

Merged
Kitenite merged 1 commit into
mainfrom
kitenite/remove-open-file-changes
Feb 12, 2026
Merged

refactor(desktop): remove auto-open first file when opening changes tab#1427
Kitenite merged 1 commit into
mainfrom
kitenite/remove-open-file-changes

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Feb 12, 2026

Summary

  • Remove the logic that automatically opens the first changed file when the Changes sidebar is toggled open
  • The sidebar button now simply toggles visibility without side effects

Changes

  • apps/desktop/src/renderer/screens/main/components/SidebarControl/SidebarControl.tsx: Removed openFirstFile callback, FILE_CATEGORIES constant, handleClick wrapper, and all supporting code (workspace/branch/status queries, store access, file viewer pane logic). The button now calls toggleSidebar directly. (-110 lines)

Test Plan

  • Click the Changes button to open the sidebar — verify no file is auto-opened in the viewer
  • Click the Changes button again to close the sidebar — verify it toggles correctly
  • Manually click a file in the changes list — verify it still opens normally

Summary by CodeRabbit

  • Refactor
    • Simplified the sidebar control component by reducing internal complexity and removing unnecessary data operations. User-facing functionality and behavior remain unchanged.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 12, 2026

📝 Walkthrough

Walkthrough

The SidebarControl component was refactored to remove extensive internal logic for workspace management, branch handling, file selection, and side effects. The onClick handler was simplified from a multi-step operation to a single toggleSidebar invocation, while the public API signature remains unchanged.

Changes

Cohort / File(s) Summary
SidebarControl Simplification
apps/desktop/src/renderer/screens/main/components/SidebarControl/SidebarControl.tsx
Removed internal logic for workspace status, branches, file selection, and content invalidation. Simplified onClick from multi-step handleClick to direct toggleSidebar call. Reduced imports and side effects while maintaining component signature.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

A rabbit cleaned house with a gleeful bound, 🐰
Removed the complexity, it weighed her down,
Just toggle, no fetch—simple and bright,
The sidebar now dances with elegant might!
Less code, more joy, the refactor's delight! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main refactoring change: removing the auto-open behavior when opening the changes tab.
Description check ✅ Passed The description covers the main change, specific file modifications, and includes a test plan. All essential information is provided despite not strictly following the template format.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch kitenite/remove-open-file-changes

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
apps/desktop/src/renderer/screens/main/components/SidebarControl/SidebarControl.tsx (1)

35-35: Nit: tooltip label says "Open" but the button toggles.

Pre-existing, but now that the component is purely a toggle, the tooltip label "Open Changes Sidebar" could be updated to "Toggle Changes Sidebar" (or made dynamic like the aria-label).

Suggested diff
 				<HotkeyTooltipContent
-					label="Open Changes Sidebar"
+					label={isSidebarOpen ? "Hide Changes Sidebar" : "Show Changes Sidebar"}
 					hotkeyId="TOGGLE_SIDEBAR"
 				/>

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 8102525 into main Feb 12, 2026
6 checks passed
@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
  • ⚠️ Streams Fly.io app

Thank you for your contribution! 🎉

@Kitenite Kitenite deleted the kitenite/remove-open-file-changes branch February 19, 2026 21:44
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