Skip to content

Commit 9d19673

Browse files
committed
Fix: hide 'Try again' button when pairing succeeds to prevent state regression
After successful pairing (status === 'paired'), clicking the 'Try again' button would re-invoke submitHostedPairingRequest, which calls addSavedEnvironment for an already-connected environment. This throws 'This environment is already connected', causing the UI to regress from the success state back to an error state. Hide the button entirely when status is 'paired', leaving only the 'Open app' button visible.
1 parent b0cf85f commit 9d19673

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

apps/web/src/components/auth/PairingRouteSurface.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,15 @@ export function HostedPairingRouteSurface() {
240240
) : null}
241241

242242
<div className="mt-6 flex flex-wrap gap-2">
243-
<Button
244-
disabled={status === "pairing"}
245-
size="sm"
246-
onClick={() => void submitHostedPairingRequest()}
247-
>
248-
{status === "pairing" ? "Pairing..." : "Try again"}
249-
</Button>
243+
{status !== "paired" ? (
244+
<Button
245+
disabled={status === "pairing"}
246+
size="sm"
247+
onClick={() => void submitHostedPairingRequest()}
248+
>
249+
{status === "pairing" ? "Pairing..." : "Try again"}
250+
</Button>
251+
) : null}
250252
{status === "paired" ? (
251253
<Button size="sm" variant="outline" onClick={() => (window.location.href = "/")}>
252254
Open app

0 commit comments

Comments
 (0)