Skip to content

Commit 10085a7

Browse files
committed
SDK: only attempt auto connect once
1 parent 7306818 commit 10085a7

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

.changeset/odd-rooms-sleep.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Only attempt autoconnect once

packages/thirdweb/src/wallets/connection/autoConnectCore.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import {
1919
import type { WalletId } from "../wallet-types.js";
2020
import type { AutoConnectProps } from "./types.js";
2121

22+
let isAutoConnectAttempted = false;
23+
2224
/**
2325
* @internal
2426
*/
@@ -47,6 +49,12 @@ export const autoConnectCore = async ({
4749
const { wallets, onConnect } = props;
4850
const timeout = props.timeout ?? 15000;
4951

52+
if (isAutoConnectAttempted) {
53+
return false;
54+
}
55+
56+
isAutoConnectAttempted = true;
57+
5058
let autoConnected = false;
5159
manager.isAutoConnecting.setValue(true);
5260

0 commit comments

Comments
 (0)