Skip to content

Commit a08b656

Browse files
committed
fix: set walletConnect to false on disconnect
1 parent bb1caab commit a08b656

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

web-marketplace/src/lib/wallet/hooks/useDisconnect.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ type Props = {
1818
setConnectionType: UseStateSetter<string | undefined>;
1919
walletConfigRef: MutableRefObject<WalletConfig | undefined>;
2020
logout?: () => Promise<void>;
21+
setWalletConnect: UseStateSetter<boolean>;
2122
};
2223

2324
export type DisconnectType = () => Promise<void>;
@@ -28,12 +29,14 @@ export const useDisconnect = ({
2829
setWallet,
2930
walletConfigRef,
3031
logout,
32+
setWalletConnect,
3133
}: Props): DisconnectType => {
3234
const { mainWallet } = useWallet(KEPLR_MOBILE);
3335

3436
const disconnect = useCallback(async (): Promise<void> => {
3537
if (walletConnect && mainWallet) {
3638
await mainWallet.disconnect(true);
39+
setWalletConnect(false);
3740
}
3841

3942
setWallet(emptySender);
@@ -47,11 +50,12 @@ export const useDisconnect = ({
4750
if (!walletConnect && logout) await logout();
4851
}, [
4952
walletConnect,
53+
mainWallet,
5054
setWallet,
5155
setConnectionType,
5256
walletConfigRef,
5357
logout,
54-
mainWallet,
58+
setWalletConnect,
5559
]);
5660

5761
return disconnect;

web-marketplace/src/lib/wallet/wallet.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ export const WalletProvider: React.FC<React.PropsWithChildren<unknown>> = ({
174174
walletConfigRef,
175175
logout,
176176
walletConnect,
177+
setWalletConnect,
177178
});
178179

179180
useAutoConnect({

0 commit comments

Comments
 (0)