Skip to content

Commit 0ce08f2

Browse files
committed
fix(gdrive): prevent duplicate concurrent token requests
A manual "Reconnect" click is simultaneously the pointerdown that satisfies an armed gesture-retry AND the button's own click handler, so both could call requestAccessToken() on the same tick. Wire up the already-present (but previously unused) isRefreshing flag as a guard.
1 parent 80d8c4d commit 0ce08f2

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/lib/util/sync/providers/google-drive/token-manager.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,14 @@ class TokenManager {
306306
}
307307

308308
requestNewToken(forceConsent = false): void {
309+
// Guards against a manual "Reconnect" click double-firing: a click is
310+
// simultaneously the pointerdown that satisfies an armed gesture-retry
311+
// AND the button's own handler, so both can call in on the same tick.
312+
if (this.isRefreshing) {
313+
console.log('Token request already in flight — ignoring duplicate call');
314+
return;
315+
}
316+
309317
const tokenClient = this.tokenClientStore;
310318
let client: any;
311319

@@ -314,6 +322,7 @@ class TokenManager {
314322
})();
315323

316324
if (client) {
325+
this.isRefreshing = true;
317326
// Determine if user has authenticated before
318327
const hasAuthenticated =
319328
browser &&

0 commit comments

Comments
 (0)