-
Notifications
You must be signed in to change notification settings - Fork 2
fix: Google OAuth infinite loading bug #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Scout jam: [74c93e4f-3ac1-4a42-917c-e211ec198b0c](https://scout.new/jam/74c93e4f-3ac1-4a42-917c-e211ec198b0c) Co-authored-by: Scout <scout@scout.new>
- Scout jam: [74c93e4f-3ac1-4a42-917c-e211ec198b0c](https://scout.new/jam/74c93e4f-3ac1-4a42-917c-e211ec198b0c) Co-authored-by: Scout <scout@scout.new>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Fixes infinite loading bug when username already exists during Google OAuth registration by updating form state management and improving error handling.
- Refactored superForm state management to properly extract and use form utilities
- Added field-specific error handling for username and email validation errors
- Updated error response structure to use consistent "message" property
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/routes/(auth)/login/google/callback/+page.svelte |
Refactored form state management to extract superForm utilities and updated form binding patterns |
src/routes/(auth)/login/google/callback/+page.server.ts |
Added field-specific error handling and standardized error response format |
docs/changes.md |
Added changelog entry documenting the bug fix |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| <input type="hidden" name="google_id" bind:value={$formData.google_id} /> | ||
| <input | ||
| type="hidden" | ||
| name="avatar_url" | ||
| value={registerFormData.avatar_url} | ||
| bind:value={$formData.avatar_url} |
Copilot
AI
Aug 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hidden inputs should use value attribute instead of bind:value since they don't need two-way data binding and the values are already managed by the form state.
| if (response.status === 400) { | ||
| const message: string = response.error.detail; | ||
| if (message.toLowerCase().includes("username")) { | ||
| form.errors.username = [message]; | ||
| } else if (message.toLowerCase().includes("email")) { | ||
| form.errors.email = [message]; | ||
| } | ||
| return fail(400, { form, message }); | ||
| } |
Copilot
AI
Aug 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message parsing using toLowerCase().includes() is fragile and could fail if the error message format changes. Consider using more specific error codes or structured error responses from the registerWithGoogle function instead of string matching.
- Scout jam: [74c93e4f-3ac1-4a42-917c-e211ec198b0c](https://scout.new/jam/74c93e4f-3ac1-4a42-917c-e211ec198b0c) Co-authored-by: Scout <scout@scout.new>
- Scout jam: [74c93e4f-3ac1-4a42-917c-e211ec198b0c](https://scout.new/jam/74c93e4f-3ac1-4a42-917c-e211ec198b0c) Co-authored-by: Scout <scout@scout.new>
Fixes infinite loading when username already exists during Google OAuth registration by properly handling form state and error messages.
₍ᐢ•(ܫ)•ᐢ₎ Generated by Scout (view jam)