Merged
Conversation
Split create_branch into two steps so the modal dismisses immediately: 1. create_branch (fast) — creates the DB record only, returns with worktreePath=null 2. setup_worktree (slow) — creates the git worktree and workdir record, called in the background by ProjectHome after the modal closes BranchCard now shows a "Creating worktree…" spinner when a local branch has no worktreePath yet. Once setup_worktree resolves, ProjectHome updates the branch record and the card transitions to its normal state, then prerun actions fire automatically. This matches the existing pattern used by remote branches (fast DB insert → dismiss → slow workspace provisioning in background).
wesbillman
approved these changes
Feb 12, 2026
taylorkmho
added a commit
that referenced
this pull request
Feb 12, 2026
* origin/main: feat: async worktree creation (#71) fix: Skip main worktree on project import and remove main badge UI (#70) feat(ui): replace long-press picker with explicit New note / New commit buttons (#67) fix: remember ordered list of recent agents instead of single last-used (#65) fix: capitalize 'Staged' in macOS application menu (#64) fix: dismiss new branch dialog immediately for remote branches (#57) feat: add Amp (Sourcegraph) as a supported ACP agent (#55) feat: restore subfolder autocomplete in new project dialog (#56) Consolidate ACP implementations into acp-client crate (#52) # Conflicts: # staged/src/lib/BranchCard.svelte # staged/src/lib/NewSessionModal.svelte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Splits local branch creation into two phases—a fast DB record insert and a background git worktree setup—so the modal dismisses instantly and the user sees a "Creating worktree…" spinner on the branch card instead of blocking on a potentially slow git operation. This mirrors the existing pattern used by remote branches (fast DB insert → dismiss → slow workspace provisioning in background).
Changes
Backend (
lib.rs)create_branchnow only creates the DB record and returns immediately withworktree_path = None— no git operationssetup_worktree(new Tauri command) takes abranch_id, looks up the branch and project, creates the git worktree, and records the workdir entry; separated so the frontend can call it in the background after the modal closesFrontend
NewBranchModal.svelte— stripped down to just callcreateBranchandonCreated; no longer orchestrates worktree setup or prerun actions itselfProjectHome.svelte— afteronCreateddismisses the modal, detects local branches with noworktreePathand kicks offsetupWorktreein the background; on success it reactively updates the branch list and then fires prerun actionsBranchCard.svelte— adds a "Creating worktree…" loading state (spinner + branch info header) for local branches that don't yet have aworktreePathcommands.ts— addssetupWorktree(branchId)wrapper and documents the two-step contract oncreateBranch