Skip to content

fix(#981): prevent multiple duplicate success toasts on guest login#996

Open
sidhanta03 wants to merge 2 commits intostagefrom
fix-guest-login-toasts
Open

fix(#981): prevent multiple duplicate success toasts on guest login#996
sidhanta03 wants to merge 2 commits intostagefrom
fix-guest-login-toasts

Conversation

@sidhanta03
Copy link
Copy Markdown

Description

Resolves #981.

Rapidly clicking the "Sign in as Guest" button previously caused multiple identical API requests
and overlapping UI success toasts.

Changes made:

  • Implemented a synchronous JavaScript lock using useRef to securely block rapid double/triple
    clicks — mathematically impossible for 2 clicks to pass the guard since refs mutate synchronously
  • Added setIsSubmit(true) for visual UI feedback while request is pending
  • Added a setTimeout cooldown inside the finally block to prevent aggressive spamming on
    fast-resolving errors
  • Used try/finally pattern to ensure lock always releases on both success and failure

What type of PR is this?

  • 🐛 Bug Fix

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in
    hard-to-understand areas
  • I have added tests
  • Existing tests pass locally

@github-actions github-actions Bot added the bug Something isn't working label Apr 12, 2026
@sonarqubecloud
Copy link
Copy Markdown

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple duplicate success toasts shown on guest login

1 participant