[Bug]: PalsHub email sign-up/sign-in no longer claims success on failure#757
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes misleading success alerts in the PalsHub email auth sheet by making email auth APIs explicitly report success/failure and only showing success alerts when the underlying call succeeds.
Changes:
- Update
AuthServiceemail auth methods (signInWithEmail,signUpWithEmail,resetPassword) to returnPromise<boolean>indicating success. - Gate
AuthSheetsuccess alerts behind the returned boolean so failures only surface via the existing inline error banner. - Add Jest coverage for failure cases and update the centralized auth service mock to match the new boolean contract.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/services/palshub/AuthService.ts |
Email auth methods now return true/false instead of swallowing errors and returning void. |
src/components/PalsHub/AuthSheet/AuthSheet.tsx |
Only shows “Account Created” / “Welcome Back!” / “Password Reset” alerts when the service reports success. |
src/components/PalsHub/AuthSheet/__tests__/AuthSheet.test.tsx |
Adds tests ensuring success alerts are not shown when mocked email auth fails. |
__mocks__/services/palshub/AuthService.js |
Updates mocked email auth methods to resolve true by default (new contract). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Problem
On the PalsHub Create Account / Sign In sheet, a failed email auth still showed a success alert. Entering a too-short password surfaced all three at once: the inline "Password should be at least 6 characters" banner, a toast error, and a false "Account Created — please check your email" alert. The account was never created.
Cause
AuthService.signUpWithEmail/signInWithEmail/resetPasswordswallowed the Supabase error intothis.errorand returnedvoid— they never threw or signalled failure.AuthSheetthen fired its success alert unconditionally after theawait(itscatchonly catches thrown errors, and these methods never throw).Fix
Promise<boolean>(trueon success,falseon error).AuthSheetonly shows the "Account Created" / "Welcome Back!" / "Password Reset" alert when the call actually succeeds. On failure the existing inline error banner remains the single error surface, and the sheet stays open so the user can correct the input.Tests
Generated by PocketPal Dev Team