From 5bf144e6ac1a52658c40edf5f15ff971b0c9f5fd Mon Sep 17 00:00:00 2001 From: naturexie <786281870@qq.com> Date: Sat, 18 Jan 2025 17:11:15 +0800 Subject: [PATCH] fix: btc wallet to switch account issue --- components/Header/WalletButton.tsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/components/Header/WalletButton.tsx b/components/Header/WalletButton.tsx index f9697143..32db2e73 100644 --- a/components/Header/WalletButton.tsx +++ b/components/Header/WalletButton.tsx @@ -44,8 +44,21 @@ const WalletButton = () => { dispatch(_hideModal()); dispatch(_hideModalMEME()); }; - const fetchData = (id?: string) => { + if ( + id && + accountId && + accountId !== id && + (window.localStorage.getItem("near-wallet-selector:selectedWalletId") == '"btc-wallet"' || + accountId.startsWith("bc1")) + ) { + // for btc wallet to switch accountId + dispatch(setAccountId(id)); + setTimeout(() => { + window.location.reload(); + }, 500); + return; + } dispatch(setAccountId(id)); dispatch(fetchAccount()); dispatch(fetchAccountMEME());