Skip to content

Commit 4db99ca

Browse files
fix(clerk): Do not throttle touch for multisession apps (#5990)
Co-authored-by: Bryce Kalow <[email protected]>
1 parent ac6b231 commit 4db99ca

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.changeset/rotten-trams-rush.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+
Drop throttling for multisession apps to fix edge cases when quickly switching between tabs with different sessions, in apps that have multisession support enabled.

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2434,7 +2434,9 @@ export class Clerk implements ClerkInterface {
24342434
return;
24352435
}
24362436

2437-
if (this.#touchThrottledUntil > Date.now()) {
2437+
// In multi-session apps, it's possible that different tabs will have different active sessions. It's critical that the tab's active session is touched in this case so the session is properly updated on the backend, and so we avoid any throttling when multi-session mode is enabled.
2438+
const multisessionMode = this.environment && !this.environment.authConfig.singleSessionMode;
2439+
if (!multisessionMode && this.#touchThrottledUntil > Date.now()) {
24382440
return;
24392441
}
24402442
this.#touchThrottledUntil = Date.now() + 5_000;

0 commit comments

Comments
 (0)