Skip to content

Scope git action progress toasts to the originating thread#1675

Open
juliusmarminge wants to merge 2 commits intomainfrom
t3code/fix-git-toast-scope
Open

Scope git action progress toasts to the originating thread#1675
juliusmarminge wants to merge 2 commits intomainfrom
t3code/fix-git-toast-scope

Conversation

@juliusmarminge
Copy link
Copy Markdown
Member

@juliusmarminge juliusmarminge commented Apr 2, 2026

Summary

  • Snapshot thread toast metadata when a git action starts so progress and result toasts stay tied to the originating thread.
  • Route internal follow-up actions through a stable ref so delayed callbacks do not retarget toasts after thread switches.
  • Export ThreadToastData for reuse and add a browser regression test covering the thread-scoped toast behavior.

Testing

  • Added apps/web/src/components/GitActionsControl.browser.tsx to verify an in-flight git action toast remains pinned to the thread that started it.
  • Not run here.

Note

Low Risk
UI-only toast-scoping and callback refactoring with a focused regression test; no changes to git operations, auth, or data persistence logic.

Overview
Git action progress/result toasts are now thread-scoped at action start: GitActionsControl snapshots threadToastData into scopedToastData and stores it on the active progress ref so subsequent toastManager.update/error/success updates don’t retarget when the active thread changes.

Follow-up actions triggered from toast CTAs are routed through a stable useEffectEvent reference, and a new GitActionsControl.browser.tsx test verifies an in-flight “Push & create PR” toast remains pinned to the originating thread after switching threads. ThreadToastData is exported from toast.tsx for reuse.

Written by Cursor Bugbot for commit 2b6fe2a. This will update automatically on new commits. Configure here.

Note

Scope git action progress toasts to the thread active at action start

Previously, toast updates during a git action (loading, success, error) used the currently active thread, so switching threads mid-action would mis-scope the toasts. Now, threadToastData (including threadId) is captured as scopedToastData when the action starts and used for all subsequent updates regardless of thread changes.

  • Adds a toastData field to ActiveGitActionProgress to store the captured snapshot for use by updateActiveProgressToast.
  • Removes useCallback memoization from several internal handlers in GitActionsControl.tsx in favor of plain const functions.
  • Exports ThreadToastData from toast.tsx and adds browser tests in GitActionsControl.browser.tsx verifying toast scoping across thread switches.

Macroscope summarized 2b6fe2a.

- Pin progress toast data to the thread that started the action
- Preserve the in-flight action callback across thread switches
- Add a regression test for scoped toast updates
- Co-authored-by: codex <codex@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 2, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 196e38f6-4190-4c92-b3c3-9c57fc6da2e2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch t3code/fix-git-toast-scope

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. labels Apr 2, 2026
- Remove ref indirection for runGitActionWithToast
- Call the effect event directly from pending and dialog flows
- Keep toast-triggered git actions working with less state plumbing
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 2, 2026

Approvability

Verdict: Approved

This is a focused bug fix ensuring git action progress toasts remain associated with the thread that initiated them, even when users switch threads mid-operation. The change is well-scoped with comprehensive test coverage validating the new behavior.

You can customize Macroscope's approvability policy. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant