-
Notifications
You must be signed in to change notification settings - Fork 962
feat: add file tree as a draggable pane #2536
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
e7a3779
1cf4a0f
6867bd2
60c9f87
5c8d783
f878bcd
797c226
6f86de9
8dfa3ce
5b9a80f
3ecf401
93a5305
d30adb6
c9f3bcb
44c055f
433d3d7
85d7416
1d49c37
028c388
cb8f280
dfd7cea
7bd787a
534c2f6
b758f1f
2784f60
48da360
869fd78
6a594a2
1fef62b
96d15b2
f9a6c6c
257a1ba
2417163
4f5d3e9
b824b4b
954595f
d34f945
c4a0324
4d6c419
9409aae
3e531b8
cdd1ff4
41184a4
7b18481
664570c
03d7fab
d14d19d
16f2b70
798c166
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 |
|---|---|---|
|
|
@@ -154,6 +154,7 @@ export const createDeleteProcedures = () => { | |
| id: z.string(), | ||
| deleteLocalBranch: z.boolean().optional(), | ||
| force: z.boolean().optional(), | ||
| trash: z.boolean().optional(), | ||
| }), | ||
| ) | ||
| .mutation(async ({ input }) => { | ||
|
|
@@ -252,13 +253,28 @@ export const createDeleteProcedures = () => { | |
| await workspaceInitManager.acquireProjectLock(project.id); | ||
|
|
||
| try { | ||
| const removeResult = await removeWorktreeFromDisk({ | ||
| mainRepoPath: project.mainRepoPath, | ||
| worktreePath: worktree.path, | ||
| }); | ||
| if (!removeResult.success) { | ||
| clearWorkspaceDeletingStatus(input.id); | ||
| return removeResult; | ||
| if (input.trash) { | ||
| // Move to Trash (recoverable) instead of permanent delete | ||
| const { existsSync } = await import("node:fs"); | ||
| if (existsSync(worktree.path)) { | ||
| const { shell } = await import("electron"); | ||
| await shell.trashItem(worktree.path); | ||
| } | ||
| // Clean up stale git worktree references | ||
| const { getSimpleGitWithShellPath } = await import( | ||
| "../utils/git-client" | ||
| ); | ||
| const git = await getSimpleGitWithShellPath(project.mainRepoPath); | ||
| await git.raw(["worktree", "prune"]); | ||
| } else { | ||
| const removeResult = await removeWorktreeFromDisk({ | ||
| mainRepoPath: project.mainRepoPath, | ||
| worktreePath: worktree.path, | ||
| }); | ||
| if (!removeResult.success) { | ||
| clearWorkspaceDeletingStatus(input.id); | ||
| return removeResult; | ||
| } | ||
| } | ||
|
Comment on lines
+256
to
278
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. Missing error handling for trash operation may leave workspace in "deleting" state. The trash path (lines 256-268) doesn't handle errors from Compare to the non-trash path (lines 270-277) which properly calls 🔧 Proposed fix to add error handling if (input.trash) {
// Move to Trash (recoverable) instead of permanent delete
- const { existsSync } = await import("node:fs");
- if (existsSync(worktree.path)) {
- const { shell } = await import("electron");
- await shell.trashItem(worktree.path);
+ try {
+ const { existsSync } = await import("node:fs");
+ if (existsSync(worktree.path)) {
+ const { shell } = await import("electron");
+ await shell.trashItem(worktree.path);
+ }
+ // Clean up stale git worktree references
+ const { getSimpleGitWithShellPath } = await import(
+ "../utils/git-client"
+ );
+ const git = await getSimpleGitWithShellPath(project.mainRepoPath);
+ await git.raw(["worktree", "prune"]);
+ } catch (error) {
+ clearWorkspaceDeletingStatus(input.id);
+ return {
+ success: false,
+ error: `Failed to trash worktree: ${error instanceof Error ? error.message : String(error)}`,
+ };
}
- // Clean up stale git worktree references
- const { getSimpleGitWithShellPath } = await import(
- "../utils/git-client"
- );
- const git = await getSimpleGitWithShellPath(project.mainRepoPath);
- await git.raw(["worktree", "prune"]);
} else {🤖 Prompt for AI Agents |
||
| } finally { | ||
| workspaceInitManager.releaseProjectLock(project.id); | ||
|
|
||
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.
Inconsistent return shape:
initialCommandsmissing for existing workspace path.The existing workspace return (lines 346-356) omits
initialCommands, while the new workspace return (lines 387-394) includesinitialCommands: null. This inconsistency could cause issues if the client expects a uniform return shape.Proposed fix: Add `initialCommands: null` for consistency
return { workspace: { ...existing, branch, lastOpenedAt: Date.now(), }, worktreePath: project.mainRepoPath, projectId: project.id, + initialCommands: null, isInitializing: false, wasExisting: true, };📝 Committable suggestion
🤖 Prompt for AI Agents