Menu

#159 fix(commit): stop the Commit spinner waiting on forge refetches

open
nobody
bug (36)
2026-08-07
2026-08-07
Anonymous
No

Originally created by: theBGuy
Originally owned by: theBGuy

The Commit button's spinner kept spinning long after the commit itself had landed: useCommit used useRepoMutation's whole-repo-subtree default together with refetchBeforeSuccess, so the mutation stayed pending until every ["repo", repo, …] query settled — including the forge-backed pull request, issue, and CI lists, which go over the network and can take minutes on a slow connection. This narrows what the commit awaits to the working tree and pushes the remaining refreshes onto a fire-and-forget path.

Invalidation logic (src/lib/git/queries.ts)

  • useCommit now passes invalidate: workingTreeKeys(repo) plus invalidateAfter: commitAftermathKeys(repo) alongside refetchBeforeSuccess, so only the working-tree refetch gates the mutation — the emptied changes list, cleared draft, and toast still land together, while history and branch counters refresh behind the toast.
  • Adds commitAftermathKeys(repo), enumerating what a commit or amend makes stale beyond the working tree: repoKeys.log / commits / branches, log-search, recent-commits, commit-authors, unpushed-count, unpushed-messages, branch-stats, stats, divergence, compare, file-log, blame, file-b64 at HEAD, the mid-operation keys (op-state, conflict-file, merge-preview, conflict-preview), and the four insights families. Forge-backed keys are deliberately excluded — a local commit cannot change forge state — and the helper's doc comment records that reasoning.
  • Extends useRepoMutation with an invalidateAfter option that is never awaited: under refetchBeforeSuccess it fires with void in onSuccess after invalidate() resolves; otherwise it fires alongside invalidate() in onSettled. Updates the surrounding doc comments on both useRepoMutation and useCommit to describe the new split.

Documentation

  • Adds changelog.d/fixed-commit-spinner.md describing the fix in user-facing terms. No README, marketing-site, or in-app guide updates: this restores expected behavior of an existing surface rather than adding or altering a documented capability, so the fragment is the whole record — a deliberate call, not an omission.

Discussion

  • Anonymous

    Anonymous - 2026-08-07
     

Log in to post a comment.