Devr.AI icon indicating copy to clipboard operation
Devr.AI copied to clipboard

Bug Report: “Signed in!” Toast Reappears When Switching Tabs

Open DecodeX15 opened this issue 1 year ago • 8 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

What happened?

🐞 Bug Report: “Sign-In Successful” Toast Reappears When Switching Tabs

📌 Issue Overview

After logging in, the user correctly sees the “Sign-In Successful” toast once.
However, when switching between browser tabs or reopening the same tab, the toast message reappears multiple times — even though the user session is already active.

This does not happen when navigating within the website using internal routes.
The issue only occurs when switching or reopening browser tabs.


🔍 Steps to Reproduce

  1. Log in to the application successfully.
  2. Observe the “Sign-In Successful” toast appearing once (✅ expected).
  3. Open a new browser tab or switch to another tab.
  4. Return to the original tab.
  5. The same “Sign-In Successful” toast appears again repeatedly.

🎯 Expected Behavior

The “Sign-In Successful” toast should appear only once, immediately after successful login —
and should not reappear when switching or reopening browser tabs.


🚨 Actual Behavior

The toast notification reappears every time the user switches back to the tab,
causing confusion and unnecessary repetition for authenticated users.


💡 Suggested Improvements

  • Before showing the success toast, check if the user is already authenticated (via cookies, localStorage, or session state).
  • Only trigger the toast when a new sign-in event occurs, not when the page gains focus again.

Example logic:

if (!toastShown && isAuthenticated) {
  showToast("Sign-In Successful");
  setToastShown(true);
}

###  🖼️ Screenshot / Screen Recording

https://github.com/user-attachments/assets/a63fccc2-8034-4b94-af1d-bdd183e17a05

### Record

- [x] I agree to follow this project's Code of Conduct
- [x] I want to work on this issue

DecodeX15 avatar Nov 12 '25 16:11 DecodeX15

@smokeyScraper sir please assign this issue to me

DecodeX15 avatar Nov 12 '25 16:11 DecodeX15

Seems reasonable to me. Assigned @Vaibhaviitian

smokeyScraper avatar Nov 13 '25 14:11 smokeyScraper

Most applications store login success state in localStorage, sessionStorage, or rely on an auth state listener that runs on page load. if (localStorage.getItem("loggedIn") === "true") { toast("Sign-In Successful"); } browser re runs this logic again and again when user switch the tab. Solution Approach

Store a flag like "hasShownLoginToast" in either:

React State (ideal)

Session Storage (OK)

In-memory flag (OK but resets on reload)

and reset it only when logging out, not when switching tabs. please can u assign this issue to me i want to worko n this..

bhavyaagarwal25 avatar Dec 01 '25 20:12 bhavyaagarwal25

@bhavyaagarwal25 i was busy with my end sem and i am working on this

DecodeX15 avatar Dec 02 '25 06:12 DecodeX15

Seems reasonable to me. Assigned @Vaibhaviitian

sir i resolved the issue kindly check pr once @smokeyScraper

coder77ai avatar Dec 03 '25 17:12 coder77ai

sir plz assign this bug

Aman344332 avatar Dec 28 '25 23:12 Aman344332

Hi @smokeyScraper , As i can see this issue is still open, i believe that i can fix this bug. So I’d like to work on this issue.

I’ve already contributed to this repository earlier, and I’ve gone through the auth and toast handling logic related to this bug.

My plan is to ensure the “Sign-In Successful” toast is triggered only on a fresh login event, and not during auth state rehydration or when switching browser tabs.

Please assign this issue to me. Thanks!!

swarneshkunden avatar Jan 07 '26 12:01 swarneshkunden

Hi @smokeyScraper,

I can reproduce this issue locally. I’ll work on ensuring the success toast only fires on a real login event and not when switching or reopening tabs. Will open a PR soon.

Thanks!

30itsadityasr avatar Feb 04 '26 19:02 30itsadityasr