Skip to content

Commit 8c1e855

Browse files
authored
fix: login flow race condition fix (#5980)
1 parent b96fcab commit 8c1e855

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

packages/shared/src/components/auth/AuthOptionsInner.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -597,15 +597,18 @@ function AuthOptionsInner({
597597
clearPopupCheck();
598598
const popup = windowPopup.current;
599599
popupCheckIntervalRef.current = setInterval(() => {
600-
if (!popup || popup.closed) {
601-
clearPopupCheck();
602-
if (!authFlowCompletedRef.current) {
603-
setIsSocialAuthLoading(false);
604-
onAuthStateUpdate?.({ isLoading: false });
605-
displayToast(SOCIAL_AUTH_RETRY_MESSAGE);
606-
}
607-
windowPopup.current = null;
600+
if (popup && !popup.closed) {
601+
return;
602+
}
603+
clearPopupCheck();
604+
windowPopup.current = null;
605+
if (authFlowCompletedRef.current) {
606+
return;
608607
}
608+
// Popup closed without delivering a completion message. The user may
609+
// still be authenticated (session cookies set even when postMessage is
610+
// missed/dropped); verify via boot before surfacing an error toast.
611+
handleLoginMessage();
609612
}, 500);
610613
};
611614

0 commit comments

Comments
 (0)