Thanks to visit codestin.com
Credit goes to github.com

Skip to content

perf: parallelize onMount calls and show loading spinner in NewBranchModal#92

Merged
matt2e merged 2 commits intomainfrom
matt2e/slow-new-branch
Feb 13, 2026
Merged

perf: parallelize onMount calls and show loading spinner in NewBranchModal#92
matt2e merged 2 commits intomainfrom
matt2e/slow-new-branch

Conversation

@matt2e
Copy link
Contributor

@matt2e matt2e commented Feb 12, 2026

Parallelizes the two async calls in the NewBranchModal's onMount (detectDefaultBranch and listGitBranches) using Promise.allSettled instead of sequential awaits. Adds a loading state with a spinner so the modal body isn't rendered until initialization completes.

Changes:

  • Run detectDefaultBranch and listGitBranches in parallel via Promise.allSettled
  • Add a loading state variable that gates the modal body content
  • Show a loading spinner while data is being fetched
  • Add .loading-state CSS for the spinner display

The New Branch dialog previously ran detectDefaultBranch and
listGitBranches sequentially in onMount, causing a visible pause before
the dialog content appeared.

- Use Promise.allSettled to fetch both in parallel
- Add a loading state with a spinner shown while data is being fetched
- Add .loading-state CSS for centered spinner layout
The New Branch dialog still blocked the UI because:

1. list_git_branches and detect_default_branch_cmd were synchronous
   Tauri commands (fn, not async fn), which run on the main thread
   and freeze the entire window until they return.

2. list_branches() called `git remote prune origin` on every open —
   a network operation that adds significant latency to what should
   be a fast local operation.

Changes:
- Make list_git_branches and detect_default_branch_cmd async so they
  run on Tauri's async thread pool instead of the main thread
- Extract `git remote prune origin` into a separate prune_remote()
  function and expose it as a new prune_remote_refs Tauri command
- Call pruneRemoteRefs as fire-and-forget in the background after the
  dialog has loaded, then silently refresh the branch list when done
- Errors from pruning are silently ignored (best-effort, e.g. no
  network or no remote configured)
@matt2e matt2e merged commit 9698f31 into main Feb 13, 2026
3 checks passed
@matt2e matt2e deleted the matt2e/slow-new-branch branch February 13, 2026 00:22
loganj pushed a commit that referenced this pull request Feb 26, 2026
* fix: add Rust/cargo check to ensure-deps

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix: export ~/.cargo/bin in PATH so all recipes see cargo after install

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix: use CARGO_HOME to locate cargo bin dir

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

---------

Co-authored-by: Claude Sonnet 4.6 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants