Skip to content

Conversation

@panteliselef
Copy link
Member

@panteliselef panteliselef commented Apr 9, 2025

Description

Original PR

This PR acts as a ground work for

  1. Introduces useAuth().sessionClaims
  2. Updates session's lastActiveToken each time /token resolves successfully
  3. Emits to resource listeners the update from the above step

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:

@changeset-bot
Copy link

changeset-bot bot commented Apr 9, 2025

🦋 Changeset detected

Latest commit: d4f8868

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

This PR includes changesets to release 22 packages
Name Type
@clerk/clerk-js Minor
@clerk/clerk-react Minor
@clerk/types Minor
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch
@clerk/elements Patch
@clerk/nextjs Patch
@clerk/react-router Patch
@clerk/remix Patch
@clerk/tanstack-react-start Patch
@clerk/agent-toolkit Patch
@clerk/astro Patch
@clerk/backend Patch
@clerk/expo-passkeys Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/localizations Patch
@clerk/nuxt Patch
@clerk/shared Patch
@clerk/testing Patch
@clerk/themes Patch
@clerk/vue 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

@vercel
Copy link

vercel bot commented Apr 9, 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 Apr 10, 2025 2:35pm

@panteliselef panteliselef force-pushed the elef/sdki-987-sessionclaims-missing-from-useauth-return branch from 917b511 to 1670fd0 Compare April 9, 2025 09:32
@panteliselef panteliselef changed the title feat(clerk-js,clerk-react): Introduce sessionClaims in useAuth() feat(clerk-js,clerk-react): Introduce sessionClaims in useAuth() Apr 9, 2025
@panteliselef panteliselef self-assigned this Apr 9, 2025
…auth-return

# Conflicts:
#	packages/clerk-js/bundlewatch.config.json
@clerk-cookie clerk-cookie removed the astro label Apr 9, 2025
Comment on lines 371 to 375
if (token.jwt) {
this.lastActiveToken = token;
// Emits the updated session with the new token to the state listeners
eventBus.dispatch(events.SessionTokenResolved, null);
}
Copy link
Member Author

@panteliselef panteliselef Apr 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reviewers:

useAuth() and useSession() were not re-rendering when the poller would generate a new token. This is necessary in order for useAuth().sessionClaims and useSession().lastActiveToken.jwt to have the correct content always, without waiting on client piggybacking.

@panteliselef panteliselef marked this pull request as ready for review April 9, 2025 12:55
Signed-off-by: panteliselef <panteliselef@outlook.com>
Copy link
Member

@octoper octoper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

…auth-return

# Conflicts:
#	packages/clerk-js/bundlewatch.config.json
#	packages/clerk-js/src/core/resources/Session.ts
@panteliselef panteliselef enabled auto-merge (squash) April 10, 2025 14:35
@panteliselef panteliselef disabled auto-merge April 10, 2025 14:35
@panteliselef panteliselef enabled auto-merge (squash) April 10, 2025 14:35
@panteliselef panteliselef merged commit 554242e into main Apr 10, 2025
30 checks passed
@panteliselef panteliselef deleted the elef/sdki-987-sessionclaims-missing-from-useauth-return branch April 10, 2025 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants