Skip to content

fix(picker): flash success feedback after alt-x removes worktree - #4669

Open
Yash2031v wants to merge 4 commits into
max-sixty:mainfrom
Yash2031v:fix/picker-remove-success-feedback
Open

Yash2031v wants to merge 4 commits into
max-sixty:mainfrom
Yash2031v:fix/picker-remove-success-feedback

Conversation

@Yash2031v

Copy link
Copy Markdown

Fixes #4636

When using alt-x to remove a worktree but keep its unmerged branch, the picker optimistically morphs the row. Previously, if the background removal succeeded, it didn't provide any visual feedback to confirm the action (unlike the failure paths).

This updates the background thread to flash a transient success message (Removed <branch> worktree; kept branch) in the header once it confirms the worktree directory is actually gone.

Also updated test_apply_morphs_unmerged_worktree_to_branch_row to wait for and assert this new header flash.

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The success flash can report that the branch was kept when removal actually deleted it. worktree_removal_keeps_branch predicts retention before the background operation, but an approved pre-remove hook can integrate the branch before remove_removed_worktree_silently captures fresh refs and delete_branch_if_safe decides its fate. The worktree path is then gone, so this else arm shows “kept branch” while the morphed / branch row points to a missing branch. Please base the confirmation and final row state on the observed branch fate after removal.

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The branch-deleted path needs the same settled preview refresh as the normal row-drop path. When this was the last selected row, the picker can keep showing the removed branch's preview after the row disappears.

Comment thread src/commands/picker/mod.rs Resolved
Co-authored-by: Worktrunk Bot <w@worktrunk.dev>

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI's lint check fails because cargo fmt rewrites the new test assignment.

Comment thread src/commands/picker/mod.rs Resolved
Co-authored-by: Worktrunk Bot <w@worktrunk.dev>

This branch has not been deployed

No deployments
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.

Show success feedback after Alt-x removes a worktree in the picker

2 participants