This repository was archived by the owner on Feb 6, 2026. It is now read-only.
fix: diff failed to view because tabs showed old branch#124
Merged
Conversation
When viewing diffs from the branch list, the branch properties are now explicitly captured using @const blocks in the Svelte template. This prevents potential closure issues where the wrong branch's information might be used if the branches array is mutated during user interaction. Changes: - Extract branch properties (id, projectId, worktreePath, baseBranch, branchName) as const values in template - Inline the view diff handlers directly in template with explicit captures - Add console logging to track which branch is being referenced - Include repo path in error messages for better debugging This ensures that clicking "View Diff" on a branch always uses the correct branch's worktree path and branch names, even if other branches are being deleted or modified concurrently. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Remove console.log and console.error statements that were added for debugging purposes. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
When tabs are restored from persistent storage, validate that worktree paths still exist before recreating the tabs. This prevents errors when trying to view diffs from branches that were deleted outside the app. The fix checks each worktree path during tab restoration and: - Skips tabs with non-existent worktree paths - Logs a warning about skipped tabs - Adjusts the active tab index if needed - Saves the cleaned-up tabs back to storage Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
When a user deletes a branch from the branch list, any open tabs viewing that branch's worktree are now automatically closed. This prevents users from interacting with stale tabs that reference deleted worktrees. The fix works by: - Capturing the worktreePath before deletion - After successful deletion, finding all tabs with matching repoPath - Closing each matching tab using the existing closeTab() function This complements the existing app-startup cleanup that filters out tabs with non-existent worktree paths, providing immediate cleanup during the current session rather than waiting until next app restart. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a bug where clicking "View Diff" on branch cards could fail or show incorrect diffs due to callbacks capturing stale references to the
branchobject.Changes
projectId,worktreePath,baseBranch,branchName,id) at render time using Svelte's{@const}declarations, ensuring callbacks always reference the correct values even if the branch list updates