fix(desktop): drop duplicate create-workspace submits while one is in flight
Summary
Cmd+Enter twice in quick succession on the new-workspace modal created two workspaces. Both local and cloud creates go through useSubmitWorkspace, which awaits attachment uploads, the cloud environment lookup, and the prompt-context build before anything observable changes — and isCreating only tracked the cloud mutation's isPending, which the Cmd+Enter handler never consulted anyway. A second activation in that window re-entered the submit.
In practice this bites cloud creates every time (the environment.list round trip runs before the mutation), while the common local create drains in microtasks before the second keydown can dispatch — local is only exposed while an attachment upload or linked PR/issue context fetch is still in flight.
The fix latches submitWorkspace for its full duration, covering all three entry points (window Cmd+Enter listener, editor Enter handler, Create button) at the source. The latch releases in finally so a submit that failed validation or errored can be retried, and isCreating now spans the same window so the Create button reads busy exactly while extra activations are dropped. Mirrors the submitStartedRef guard the v1 modal already has.
Test plan
-
tsc --noEmitand biome clean onapps/desktop - Cloud workspace: double Cmd+Enter → one workspace, button shows pending
- Local workspace: double Cmd+Enter → one workspace
- Failed submit (e.g. no project selected) can be corrected and resubmitted
Summary by cubic
Fixes double Cmd+Enter creating two workspaces from the new-workspace modal. A second submit is now dropped while one is in flight, and the Create button stays busy for the entire submit instead of only during the cloud create call.
Bug Fixes
- Covers the window Cmd+Enter listener, editor Enter handler, and Create button.
- Failed or invalid submits can be corrected and retried, since the guard releases when the submit finishes.
Summary by CodeRabbit
- Bug Fixes
- Prevented duplicate workspace creation when the submit action is triggered multiple times quickly.
- Improved submission-state feedback so the form remains accurately marked as processing until the workspace request finishes.