Skip to content

fix: Prevent anonymous sign-in cancellation during onboarding#96

Open
justanotheratom wants to merge 1 commit intomainfrom
forensics
Open

fix: Prevent anonymous sign-in cancellation during onboarding#96
justanotheratom wants to merge 1 commit intomainfrom
forensics

Conversation

@justanotheratom
Copy link
Collaborator

Summary

  • Wraps anonymous sign-in in an unstructured Task so .task(id:) cancellation (from route changes) no longer kills the in-flight network request
  • Gates "Just Me" and "Add Family" button actions on signIn() completion with a session nil-check, preventing authError on downstream API calls
  • Deduplicates concurrent signIn() callers via a stored @MainActor task handle
  • Captures the Session returned by Supabase directly instead of discarding it, so session is set before signIn() returns (no reliance on async watcher)
  • Removes dead legacy guest sign-in code (signInWithLegacyGuest, clearAnonymousCredentials, keychain keys) — nothing ever wrote those keys

Test plan

  • Go through onboarding, tap "Add Family" quickly (~1s after .whosThisFor appears) — should see brief spinner, then navigate successfully
  • Test "Just Me" path similarly
  • Check logs: signInAnonymously should NOT show "cancelled", createFamily should succeed
  • Test with airplane mode: button spinner should show, then stop, user stays on screen
  • Verify no duplicate signInAnonymously calls when pre-warm and button both trigger

🤖 Generated with Claude Code

Sign-in was getting cancelled when users tapped buttons on the .whosThisFor
screen because .task(id:) cancels in-flight work on route change. Fix by
wrapping sign-in in an unstructured Task that survives cancellation, gating
button actions on sign-in completion, and deduplicating concurrent callers.

Also removes dead legacy guest sign-in code (signInWithLegacyGuest,
clearAnonymousCredentials, anonUserNameKey/anonPasswordKey) — nothing
ever wrote those keychain keys.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant