feat(staged): delete project with command shortcut - #832
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 73da4cd092
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| void handleDeleteProjectRequest(selectedProject).finally(() => { | ||
| deleteShortcutPending = false; | ||
| }); |
There was a problem hiding this comment.
Suppress repeated delete shortcut until keyup
When the current project is safe to delete, such as a project with repoCount === 0, handleDeleteProjectRequest can finish before the user releases Cmd+Backspace. This finally then clears the only repeat guard after confirmDeleteProject() has already navigated to the next project, so subsequent auto-repeat keydown events from the same key hold will dispatch again and remove additional projects without another confirmation. Keep the shortcut latched until keyup or ignore KeyboardEvent.repeat for this destructive action.
Useful? React with 👍 / 👎.
Signed-off-by: Matt Toohey <contact@matttoohey.com>
Holding Cmd+Backspace on a safe-to-delete project could start multiple deleteProject calls, since none of the shortcut's guard conditions (selectedProjectDeleting, projectToDelete, etc.) are set until the async canDeleteProjectWithoutConfirmation check resolves. Repeated keydown events would each dispatch handleDeleteProjectRequest before any guard flipped. Add a synchronous deleteShortcutPending flag set before dispatching and cleared once the request settles, so a held key only deletes once. Signed-off-by: Matt Toohey <contact@matttoohey.com>
Summary
Adds a keyboard shortcut and macOS menu item to delete the current project from the project view.
CmdOrCtrl+Backspace), wired through to amenu:delete-projectevent.app-delete-projectshortcut (Cmd+Backspace/Cmd+Delete) that dispatches a cancelablestaged:delete-current-projectevent, but only when no text input is focused and the active route is a project.ProjectHomelistens for the event and triggers the existing delete-project flow for the selected project.Guards
deleteShortcutPendingflag guards against a held key firing the delete repeatedly while the async safe-to-delete check is in flight, and the handler bails out if a delete/new-project/add-repo modal is already open.