Repository navigation
refactor(clerk-js): refactor tokenCache for readability - #10468
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 8411927 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types 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 |
|
No actionable comments were generated in the recent review.
|
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/electron
@clerk/electron-passkeys
@clerk/eslint-plugin
@clerk/expo
@clerk/expo-biometrics
@clerk/expo-google-signin
@clerk/expo-native-components
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/mosaic
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
4d8aeb3 to
8411927
Compare
API Changes Report
Summary
No API Changes DetectedAll packages have stable APIs with no detected changes. Report generated by Break Check Last ran on |
Description
👨:
I thought
tokenCachewas hard to read and realized it was mostly two things, naming and the fact we were storing the token multiple times. Renames here are subjective so do feel free to push back if it didn't help readability for you.Note that there are a bunch of test changes that look like they are tweaking the tests, but they should actually be stricter now except for the unused feature explicitly dropped below.
🤖:
Stacked on #10429. Readability refactor of
SessionTokenCache; no behaviour change.resolvedTokenback onto the object passed toset(). Each entry stores its freshest known token and anisPendingflag, andget()derives the served token from those. The token and its expiry now come from the same record, so they can't drift apart.get()returns{ token?, tokenResolver }instead of the stored entry.Session.tschanges by one line.TokenCacheEntry→TokenCacheSetParams(what callers pass toset())TokenCacheValue→TokenCacheEntry(the stored record per key). Note thatTokenCacheEntrynow means something different from before.TokenCacheGetResult→TokenCacheHitCachedToken→TokenWithExpiryfreshest→freshestKnowncachedAt→createdAtresolvedTokentoset(). No production caller used it.Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change
Stack created with GitHub Stacks CLI • Give Feedback 💬