-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Allow deleting projects with chats #1753
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
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 |
|---|---|---|
|
|
@@ -65,7 +65,14 @@ export function useThreadActions() { | |
| }, []); | ||
|
|
||
| const deleteThread = useCallback( | ||
| async (threadId: ThreadId, opts: { deletedThreadIds?: ReadonlySet<ThreadId> } = {}) => { | ||
| async ( | ||
| threadId: ThreadId, | ||
| opts: { | ||
| deletedThreadIds?: ReadonlySet<ThreadId>; | ||
| skipWorktreeConfirm?: boolean; | ||
| suppressNavigation?: boolean; | ||
| } = {}, | ||
| ) => { | ||
| const api = readNativeApi(); | ||
| if (!api) return; | ||
| const { projects, threads } = useStore.getState(); | ||
|
|
@@ -83,6 +90,7 @@ export function useThreadActions() { | |
| : null; | ||
| const canDeleteWorktree = orphanedWorktreePath !== null && threadProject !== undefined; | ||
| const shouldDeleteWorktree = | ||
|
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. 🟡 Medium When 🤖 Copy this AI Prompt to have your agent fix this: |
||
| !opts.skipWorktreeConfirm && | ||
|
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. skipWorktreeConfirm skips deletion, not just confirmationMedium Severity The Additional Locations (1)Reviewed by Cursor Bugbot for commit 1e0acdd. Configure here. |
||
| canDeleteWorktree && | ||
| (await api.dialogs.confirm( | ||
|
Comment on lines
91
to
95
|
||
| [ | ||
|
|
@@ -127,7 +135,7 @@ export function useThreadActions() { | |
| clearProjectDraftThreadById(thread.projectId, thread.id); | ||
| clearTerminalState(threadId); | ||
|
|
||
| if (shouldNavigateToFallback) { | ||
| if (shouldNavigateToFallback && !opts.suppressNavigation) { | ||
| if (fallbackThreadId) { | ||
| await navigate({ | ||
| to: "/$threadId", | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PendingProjectDeletesnapshotsthreadIds/threadCountat context-menu time. If threads are created/moved/deleted before the user confirms, this list can become stale (e.g., leaving threads behind or causingproject.deleteto fail because the project is no longer empty, and the dialog count can be inaccurate). Prefer recomputing the current thread IDs for the project at confirm-time (or store onlyprojectId/projectNameand derive the rest).