@solana/wallet-adapter-react
Advanced tools
Comparing version 0.15.13 to 0.15.14
@@ -79,2 +79,3 @@ "use strict"; | ||
return prevWallets; | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const { adapter } = prevWallets[index]; | ||
@@ -102,30 +103,2 @@ return [...prevWallets.slice(0, index), { adapter, readyState }, ...prevWallets.slice(index + 1)]; | ||
}, [name, wallets]); | ||
// If autoConnect is enabled, try to connect when the adapter changes and is ready | ||
(0, react_1.useEffect)(() => { | ||
if (isConnecting.current || | ||
connecting || | ||
connected || | ||
!autoConnect || | ||
!adapter || | ||
!(readyState === wallet_adapter_base_1.WalletReadyState.Installed || readyState === wallet_adapter_base_1.WalletReadyState.Loadable)) | ||
return; | ||
(function () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
isConnecting.current = true; | ||
setConnecting(true); | ||
try { | ||
yield adapter.connect(); | ||
} | ||
catch (error) { | ||
// Clear the selected wallet | ||
setName(null); | ||
// Don't throw error, but handleError will still be called | ||
} | ||
finally { | ||
setConnecting(false); | ||
isConnecting.current = false; | ||
} | ||
}); | ||
})(); | ||
}, [isConnecting, connecting, connected, autoConnect, adapter, readyState]); | ||
// If the window is closing or reloading, ignore disconnect and error events from the adapter | ||
@@ -177,2 +150,30 @@ (0, react_1.useEffect)(() => { | ||
}, [adapter]); | ||
// If autoConnect is enabled, try to connect when the adapter changes and is ready | ||
(0, react_1.useEffect)(() => { | ||
if (isConnecting.current || | ||
connecting || | ||
connected || | ||
!autoConnect || | ||
!adapter || | ||
!(readyState === wallet_adapter_base_1.WalletReadyState.Installed || readyState === wallet_adapter_base_1.WalletReadyState.Loadable)) | ||
return; | ||
(function () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
isConnecting.current = true; | ||
setConnecting(true); | ||
try { | ||
yield adapter.connect(); | ||
} | ||
catch (error) { | ||
// Clear the selected wallet | ||
setName(null); | ||
// Don't throw error, but handleError will still be called | ||
} | ||
finally { | ||
setConnecting(false); | ||
isConnecting.current = false; | ||
} | ||
}); | ||
})(); | ||
}, [isConnecting, connecting, connected, autoConnect, adapter, readyState]); | ||
// Connect the adapter to the wallet | ||
@@ -179,0 +180,0 @@ const connect = (0, react_1.useCallback)(() => __awaiter(void 0, void 0, void 0, function* () { |
{ | ||
"name": "@solana/wallet-adapter-react", | ||
"version": "0.15.13", | ||
"version": "0.15.14", | ||
"author": "Solana Maintainers <maintainers@solana.foundation>", | ||
@@ -50,3 +50,4 @@ "repository": "https://github.com/solana-labs/wallet-adapter", | ||
"ts-jest": "^28.0.7" | ||
} | ||
}, | ||
"gitHead": "63cdb81401b4f9c0185edecc852fd3087f87616e" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
128903
2118