fix: Handle existing username error on Google callback#108
Closed
fix: Handle existing username error on Google callback#108
Conversation
The google callback page would load indefinitely when a user tried to save a profile with a username that already existed. This was because the frontend was not handling the error response from the backend. This commit fixes the issue by updating the `onResult` and adding an `onError` callback to the `superForm` instance on the google callback page. The `onResult` callback now handles the `failure` case and displays an error message on the username field. The `isSubmitting` state is also reset correctly, preventing the form from hanging. Also, updated the changelog.
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug where the Google OAuth callback page would hang indefinitely when a user attempted to create a profile with an existing username. The fix ensures proper error handling and UI state management by adding error callbacks and resetting the submission state.
- Added proper error handling for username conflicts in the Google callback form
- Added
onErrorcallback to reset form submission state - Updated the changelog to document the bug fix
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/routes/(auth)/login/google/callback/+page.svelte | Added error handling logic to prevent infinite loading and display username errors |
| docs/changes.md | Updated changelog with the bug fix entry |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Updated the changelog to link to the pull request and to be more concise, following the project's changelog style.
Member
Author
|
It doesn't work |
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.
The google callback page would load indefinitely when a user tried to save a profile with a username that already existed. This was because the frontend was not handling the error response from the backend.
This commit fixes the issue by updating the
onResultand adding anonErrorcallback to thesuperForminstance on the google callback page. TheonResultcallback now handles thefailurecase and displays an error message on the username field. TheisSubmittingstate is also reset correctly, preventing the form from hanging.Also, updated the changelog.