Skip to content

fix(clerk-js): Avoid client updates on sign out #5204

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

panteliselef
Copy link
Member

Description

Prior to long lived clients, we were calling client.destroy which will not cause #emit to fire as part of Clerk.updateClient. Once long lived client got introduced, we started using client.removeSessions() which do update the client causing an early #emit to fire prior to the expected setActive.

The problem

If an <SignedIn/> RSC was used to wrap to protect some client side code that was blindly expected sessionId from useAuth to always be defined, it would break.

Checklist

  • pnpm test runs as expected.
  • 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

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

Copy link

changeset-bot bot commented Feb 20, 2025

🦋 Changeset detected

Latest commit: 3b63578

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@clerk/clerk-js Patch
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Feb 20, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
clerk-js-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 20, 2025 11:54am

@panteliselef panteliselef force-pushed the elef/sdki-886-avoid-early-emit-when-removing-sessions branch from 13d6f19 to 3b63578 Compare February 20, 2025 11:53
@panteliselef panteliselef requested a review from a team February 20, 2025 15:30
@panteliselef panteliselef self-assigned this Mar 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants