Skip to content

Handle getUser rejection in onAuthStateChange - #2

Merged
max-bader merged 1 commit into
mainfrom
claude/error-recent-changes-e625a2
Jul 16, 2026
Merged

max-bader merged 1 commit into
mainfrom
claude/error-recent-changes-e625a2

Conversation

@max-bader

Copy link
Copy Markdown
Contributor

What

In onAuthStateChange, the initial auth.getUser() call had no rejection handler. This adds a .catch() so a failed lookup notifies the listener with SIGNED_OUT / null instead of surfacing an unhandled promise rejection.

auth
  .getUser()
  .then(({ data }) =>
    callback(data.user ? "SIGNED_IN" : "SIGNED_OUT", data.user),
  )
  .catch(() => callback("SIGNED_OUT", null));

Testing

  • bun run typecheck — passes
  • bun test — 18 pass, 0 fail

🤖 Generated with Claude Code

If the initial auth.getUser() call rejects, fall back to notifying
the listener with SIGNED_OUT / null instead of leaving an unhandled
promise rejection.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@max-bader max-bader self-assigned this Jul 16, 2026
@max-bader
max-bader requested a review from jonahc44 July 16, 2026 14:29
@max-bader
max-bader merged commit 94fb562 into main Jul 16, 2026
3 checks passed
@max-bader
max-bader deleted the claude/error-recent-changes-e625a2 branch July 16, 2026 14:30
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