Skip to content

Commit a11c2da

Browse files
fix(clerk-js): Remove the hydrate cache change for session (#7329)
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 4fae43c commit a11c2da

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

.changeset/two-candles-yawn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/clerk-js': patch
3+
---
4+
5+
Reverts the changes introduced in [PR #7105](https://github.com/clerk/javascript/pull/7105), as it was causing JWTs returned from client piggybacking not to be inserted into the cache even though their claims had actually changed.

packages/clerk-js/src/core/resources/Session.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,9 @@ export class Session extends BaseResource implements SessionResource {
131131
};
132132

133133
#hydrateCache = (token: TokenResource | null) => {
134-
if (!token) {
135-
return;
136-
}
137-
138-
const tokenId = this.#getCacheId();
139-
const existing = SessionTokenCache.get({ tokenId });
140-
if (!existing) {
134+
if (token) {
141135
SessionTokenCache.set({
142-
tokenId,
136+
tokenId: this.#getCacheId(),
143137
tokenResolver: Promise.resolve(token),
144138
});
145139
}

0 commit comments

Comments
 (0)