Skip to content

Conversation

@Axyl1410
Copy link

Description:

This pull request resolves the bug where the success toast notification on the registration page was triggered in a continuous loop.

Fixes #1246

Summary of Changes
The root cause was an issue in the state management logic following a successful user registration. The isSuccess state was being set to true but was never reset, causing any component dependent on this state to re-render and re-trigger the toast display function.

This PR introduces the following changes:

Refactored the registration submission handler to reset the success state immediately after the toast notification is dispatched.

Ensured the effect that triggers the toast only runs once when the success state changes from false to true.

How to Test
Check out this branch.

Navigate to the registration page (/register).

Fill in the form with valid user details and click "Create Account".

Verify that the "Account created successfully!" toast appears only once.

Verify that the toast fades out or can be dismissed, and no further toasts appear afterward.

@vercel
Copy link

vercel bot commented Sep 28, 2025

@Axyl1410 is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

@LeyoNeuroAI
Copy link
Contributor

tested this fix and it works, it is an important bug fix

@DrMoshtael
Copy link
Contributor

The toast reappearing is a symptom, not a cause. The cause is simply that having router.refresh and updateSession in the dependency array of useEffect on the login and register pages causes the effect to re-run every render. So simply removing them fixes it.
Pull request for login
Pull request for register

@dancer
Copy link
Contributor

dancer commented Nov 1, 2025

already solved, ping me if anything else is needed or comes up

thanks a bunch

@dancer dancer closed this Nov 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Registration toast notification is triggered in an infinite loop

4 participants