javascript icon indicating copy to clipboard operation
javascript copied to clipboard

fix(clerk-react): Correct useAuth().isLoaded in transitive state

Open jacekradko opened this issue 3 months ago • 8 comments

Description

When isomorphicClerk is loaded, we should return isLoaded: false from useAuth() when transitive state is set.

The check ensures we only override auth state with initial values when Clerk SDK hasn't loaded yet. Once loaded, we respect the actual auth state, even if it's transitioning, so components know to wait until session data is fully resolved.

Screenshot 2025-11-05 at 3 09 16 PM

Checklist

  • [x] pnpm test runs as expected.
  • [x] pnpm build runs as expected.
  • [ ] (If applicable) JSDoc comments have been added or updated for any package exports
  • [ ] (If applicable) Documentation has been updated

Type of change

  • [x] 🐛 Bug fix
  • [ ] 🌟 New feature
  • [ ] 🔨 Breaking change
  • [ ] 📖 Refactoring / dependency upgrade / documentation
  • [ ] other:

Summary by CodeRabbit

  • Bug Fixes

    • Authentication hook now reports isLoaded = false when the auth system is in a transitive/loading state to avoid showing stale auth status.
  • Tests

    • Added a test verifying the hook returns isLoaded = false and no session/user IDs while auth is transitive.
  • Chores

    • Added release metadata for a patch version bump.

jacekradko avatar Nov 05 '25 16:11 jacekradko