-
Notifications
You must be signed in to change notification settings - Fork 3.3k
fix(server): make worktree removal idempotent and keep bulk delete going #4615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
2fb0ffc
bd9c32b
b6dccf4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1838,26 +1838,34 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec | |
| if (!confirmed) return; | ||
| } | ||
|
|
||
| const deletedThreadKeys = new Set(threadKeys); | ||
| for (const { threadRef } of selectedThreadEntries) { | ||
| // Grown as deletions actually land, never seeded with the whole batch: | ||
| // orphaned-worktree detection must only discount threads that are | ||
| // really gone, or the first delete would treat still-alive batch mates | ||
| // as deleted and remove a worktree they still point at. | ||
| const deletedThreadKeys = new Set<string>(); | ||
| let firstError: unknown = null; | ||
| for (const { threadKey, threadRef } of selectedThreadEntries) { | ||
| const result = await deleteThread(threadRef, { | ||
| deletedThreadKeys, | ||
| }); | ||
| if (result._tag === "Failure") { | ||
| if (!isAtomCommandInterrupted(result)) { | ||
| const error = squashAtomCommandFailure(result); | ||
| toastManager.add( | ||
| stackedThreadToast({ | ||
| type: "error", | ||
| title: "Failed to delete threads", | ||
| description: error instanceof Error ? error.message : "An error occurred.", | ||
| }), | ||
| ); | ||
| } | ||
| return; | ||
| if (isAtomCommandInterrupted(result)) break; | ||
| // One bad thread must not abort the rest of the selection. | ||
| firstError ??= squashAtomCommandFailure(result); | ||
| continue; | ||
| } | ||
| deletedThreadKeys.add(threadKey); | ||
| } | ||
| if (firstError !== null) { | ||
| toastManager.add( | ||
| stackedThreadToast({ | ||
| type: "error", | ||
| title: "Failed to delete threads", | ||
| description: firstError instanceof Error ? firstError.message : "An error occurred.", | ||
| }), | ||
| ); | ||
| } | ||
| removeFromSelection(threadKeys); | ||
| removeFromSelection([...deletedThreadKeys]); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Stale bulk selection keys persistMedium Severity After bulk delete, Reviewed by Cursor Bugbot for commit b6dccf4. Configure here. |
||
| }, | ||
| [ | ||
| appSettingsConfirmThreadArchive, | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.