Skip to content

Commit 6adb30f

Browse files
committed
Merge branch 'main' into poc/sw
2 parents 5cc846a + 4db99ca commit 6adb30f

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
@@ -2443,7 +2443,9 @@ export class Clerk implements ClerkInterface {
24432443
return;
24442444
}
24452445

2446-
if (this.#touchThrottledUntil > Date.now()) {
2446+
// 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.
2447+
const multisessionMode = this.environment && !this.environment.authConfig.singleSessionMode;
2448+
if (!multisessionMode && this.#touchThrottledUntil > Date.now()) {
24472449
return;
24482450
}
24492451
this.#touchThrottledUntil = Date.now() + 5_000;

0 commit comments

Comments
 (0)