Repository navigation
fix(web): dismissing the pull request checkout toast stops the handoff #34509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7691a54
c889e5c
8c11cf3
7e538db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -332,17 +332,28 @@ export function usePullRequestHandoffs({ | |
| ) => { | ||
| if (!detail || handoff !== null) return; | ||
| setHandoff(kind); | ||
| // Dismissing the loading toast cancels the handoff before it touches a draft. | ||
| let cancelled = false; | ||
| // Explicit timeouts survive toast updates and would pin the result after loading. | ||
| const toastId = toastManager.add({ | ||
| type: "loading", | ||
| title: `Preparing the ${terminology.singular} checkout...`, | ||
| data: { | ||
| onClose: () => { | ||
| cancelled = true; | ||
| }, | ||
| }, | ||
| }); | ||
| const projectRef = scopeProjectRef(environmentId, detail.projectId); | ||
| // Checkout setup requires the thread to exist first. | ||
| const opened = await newThread(projectRef).then( | ||
| (session) => session, | ||
| () => null, | ||
| ); | ||
| if (cancelled) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Stop the initial thread operation from navigating after dismissal. If the user dismisses the toast while
|
||
| setHandoff(null); | ||
| return; | ||
| } | ||
| if (opened === null) { | ||
| setHandoff(null); | ||
| toastManager.update(toastId, { | ||
|
|
@@ -357,6 +368,10 @@ export function usePullRequestHandoffs({ | |
| mode, | ||
| threadId: opened.threadId, | ||
| }); | ||
| if (cancelled) { | ||
| setHandoff(null); | ||
| return; | ||
| } | ||
| if (prepared._tag === "Failure") { | ||
| setHandoff(null); | ||
| toastManager.update(toastId, { | ||
|
|
@@ -376,6 +391,10 @@ export function usePullRequestHandoffs({ | |
| (session) => session, | ||
| () => null, | ||
| ); | ||
| if (cancelled) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep the checkout draft and PR context consistent. If dismissal occurs while the second
|
||
| setHandoff(null); | ||
| return; | ||
| } | ||
| if (pointed === null) { | ||
| setHandoff(null); | ||
| toastManager.update(toastId, { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Show that cancellation is waiting for checkout.
If the component remains mounted while checkout is slow, dismissal only sets
cancelled.handoffremains set until checkout settles, so the action still shows “Preparing...” and stays disabled without the toast. Separate the canceled UI state from checkout serialization, or show that checkout is still finishing. (raw.githubusercontent.com)