fix(workspace): clear sidebar git branch and PR when focused panel closes
Closed
BI
7mo ago+10+10+01234567890123456789-0-0-0123456789
Summary
- What changed? Clear workspace-level
gitBranchandpullRequestproperties when the focused panel is closed indidCloseTabandsplitTabBar(_:didClosePane:). - Why? The sidebar notification message for a workspace (e.g., "PR opened: ...") was persisting even after all processes exited and the branch changed. This caused stale PR information to remain visible in the sidebar.
Root Cause
When a panel was closed, the code correctly removed entries from panelGitBranches and panelPullRequests dictionaries, but the workspace-level gitBranch and pullRequest properties were not being cleared if the closed panel was the currently focused panel.
Fix
Added checks after removing panel entries to clear gitBranch and pullRequest when panelId == focusedPanelId in both:
didCloseTabmethod (single tab close)splitTabBar(_:didClosePane:)method (pane close with multiple tabs)
Testing
- Verified the fix compiles successfully with
swiftc -parse - The change is minimal and follows the existing code patterns in
clearPanelGitBranchandclearPanelPullRequest
Fixes #1642
Summary by cubic
Clear workspace gitBranch and pullRequest when the focused panel or tab closes to stop stale branch/PR notifications in the sidebar.
- Bug Fixes
- In
didCloseTabandsplitTabBar(_:didClosePane:), whenpanelId == focusedPanelId, setgitBranchandpullRequesttonilafter removing panel entries. - Addresses #1642 where the sidebar kept showing PR info from a closed panel.
- In
Summary by CodeRabbit
- Bug Fixes
- Fixed an issue where closing a focused panel could leave outdated Git branch and pull request data in the application state, potentially causing unexpected behavior or display issues.