Skip to content

fix(auth): handle Google sign-in popup dismissal gracefully#1878

Open
prakriti-shrestha wants to merge 1 commit intoruxailab:developfrom
prakriti-shrestha:fix/issue-1877-google-signin-popup-freeze
Open

fix(auth): handle Google sign-in popup dismissal gracefully#1878
prakriti-shrestha wants to merge 1 commit intoruxailab:developfrom
prakriti-shrestha:fix/issue-1877-google-signin-popup-freeze

Conversation

@prakriti-shrestha
Copy link

What does this PR do?

Fixes a bug where closing the Google sign-in popup mid-flow caused the sign-in page to freeze completely, requiring a full page reload to recover.

Related Issue

Closes #1877

Root Cause Analysis

Bug 1 - SignInView.vue: wrong method to reset loading state onGoogleSignInError was calling:

store.dispatch('setLoading', false) // dispatch is for actions

But setLoading is a mutation, not an action. dispatch silently fails, leaving loading = true forever - freezing all buttons.

Bug 2 - Auth.js: no finally block in signInWithGoogle Every other action (signin, logout, resetPassword) resets loading in a finally block. signInWithGoogle had no finally, so any error left loading stuck even if Bug 1 was fixed.

Bug 3 - Auth.js: popup close treated as a real error auth/popup-closed-by-user is a deliberate user action, not an error. It was being caught and shown as a generic error toast.

Changes Made

src/features/auth/views/SignInView.vue

  • Changed store.dispatch('setLoading', false)store.commit('setLoading', false) in onGoogleSignInError

src/features/auth/store/Auth.js

  • Added finally block to signInWithGoogle to always reset loading state
  • Added silent error handling for auth/popup-closed-by-user and auth/cancelled-popup-request these are intentional user actions and should not show an error toast

Fix Flow

User closes Google popup
  → Firebase throws auth/popup-closed-by-user
  → silentErrors check: skip toast ✓
  → finally: commit('setLoading', false) ✓
  → onGoogleSignInError: store.commit('setLoading', false) ✓
  → loadingType reset to '' ✓
  → Page fully interactive again ✓

Testing

  • Close Google popup → no error toast, page remains interactive
  • Close Google popup → can immediately retry Google sign-in
  • Close Google popup → can immediately use email sign-in
  • Successful Google sign-in → redirects to /admin correctly
  • Wrong email/password → still shows correct error message
  • Normal email sign-in unaffected by these changes

Demo

Before: Throws error and the page freezes

After: No error thrown and the page is responsive.

signin_google_popup_solved.mp4

@sonarqubecloud
Copy link

@prakriti-shrestha
Copy link
Author

Hi @marcgc21 I found and fixed this bug while working on #1872 . Happy to make any changes based on your feedback!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐞 BUG]: fix(auth): Google sign-in popup dismissal freezes UI and shows generic error

1 participant