fix(login): move try/catch inside startTransition and use notificationManager#164
Merged
Merged
Conversation
farhan2742
approved these changes
Jun 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🚀 Description
Fix error handling in the Google login flow where the
try/catchwas placed outsidestartTransition, causing async errors thrown inside the transition callback to be silently swallowed rather than caught.📌 Summary
The
try/catchblock was wrappingstartTransition(...)itself, but sincestartTransitionschedules an async callback, any error thrown inside it would escape the outer catch. This PR movestry/catchinside thestartTransitioncallback to correctly catch login errors, and usesnotificationManager(the imperative API) instead of theshowNotificationhook — which is not reliably callable inside async transition callbacks.🔧 Changes Implemented
try/catchinside thestartTransitioncallback to properly catch async errorsshowNotification(hook) withnotificationManager.showNotification(imperative API) for error display inside the async transitionnotificationManagerfrom@/components/Notification🛠️ How It Works?
startTransitionschedules the async login flow.loginAndSetCookieor dispatch throws, thecatchblock inside the transition now correctly intercepts the error.notificationManager.showNotificationis called imperatively (no React hook constraints) to display the error toast to the user.✅ Checklist Before Merging
showNotificationusage for the "No credential received" case.🔗 Related Issues
https://projects.arbisoft.com/arbisoft/browse/ASP-161/
📢 Notes for Reviewers
try/catch— previously it wrappedstartTransition(callback)which does not propagate async errors thrown inside the callback. Moving it inside is the correct pattern.notificationManageris the imperative alternative to theuseNotificationhook; it's the right choice when calling from inside a non-hook context like an async transition callback.