When connecting the Keplr Mobile wallet with Wallect Connect, I set it to connect to an existing session if one exists.
Reasons for the change
For examples, proceed to the example source in cosmos-kit.
The connection works fine when there are no sessions.
![first connect]()
However, if you refresh the page after connecting, it will request connect multiple times due to the source below in the packages/react-lite/src/hooks/useChain.ts file.
// temporary solution for sync not working when the used chain is changed without page rendering (only component rendering)
useEffect(() => {
const currentWallet = window.localStorage.getItem(
'cosmos-kit@2:core//current-wallet'
);
if (
sync &&
chainWalletContext &&
chainWalletContext.isWalletDisconnected &&
currentWallet
) {
connect(currentWallet);
}
}, [chain, assetList]);
Ask the app to confirm the connection via wallect connect signClinet.connect.
Overview
When connecting the
Keplr Mobile
wallet withWallect Connect
, I set it to connect to anexisting session
if one exists.Reasons for the change
For examples, proceed to the example source in cosmos-kit.
packages/react-lite/src/hooks/useChain.ts
file.signClinet.connect
.What changed.
initKeplrWCClient
after connecting viaKeplr Mobile
, instead of creatinginitKeplrWCClient
with an existingsession
if one exists