web3modal-react-native icon indicating copy to clipboard operation
web3modal-react-native copied to clipboard

[bug]: useWalletInfo Returns Stale Values After Disconnect

Open CMLCNL opened this issue 1 year ago • 1 comments

Description

I’m encountering an issue where the useWalletInfo hook continues to return stale values even after the wallet has been disconnected. Specifically, after disconnecting from the wallet, I expect the useWalletInfo hook to return null, undefined, or an appropriate empty state to reflect the disconnection. However, the hook still returns the last connected wallet’s information, which leads to inconsistent and unexpected behavior in the application.

AppKit SDK version

@web3modal/wagmi-react-native": "^2.0.1

Output of npx react-native info

System: OS: macOS 14.5 CPU: (10) arm64 Apple M1 Pro Memory: 96.56 MB / 16.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 22.5.1 path: ~/.nvm/versions/node/v22.5.1/bin/node Yarn: version: 1.22.22 path: ~/.nvm/versions/node/v22.5.1/bin/yarn npm: version: 10.8.2 path: ~/.nvm/versions/node/v22.5.1/bin/npm Watchman: version: 2024.07.15.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.15.2 path: /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: - DriverKit 23.5 - iOS 17.5 - macOS 14.5 - tvOS 17.5 - visionOS 1.2 - watchOS 10.5 Android SDK: Not Found IDEs: Android Studio: 2024.1 AI-241.18034.62.2411.12071903 Xcode: version: 15.4/15F31d path: /usr/bin/xcodebuild Languages: Java: version: 17.0.12 path: /usr/bin/javac Ruby: version: 3.3.4 path: /opt/homebrew/opt/ruby/bin/ruby npmPackages: "@react-native-community/cli": Not Found react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.73.2 wanted: 0.73.2 react-native-macos: Not Found npmGlobalPackages: "react-native": Not Found Android: hermesEnabled: true newArchEnabled: false iOS: hermesEnabled: true newArchEnabled: false

Expo Version (if applies)

No response

Steps to reproduce

1.	Connect to a wallet using wallet connect.
2.	Observe that the hook returns the expected wallet information (e.g., wallet name, address).
3.	Disconnect the wallet.
4.	Observe that useWalletInfo still returns the previously connected wallet’s information instead of resetting or returning an empty state.

Snack, code example, screenshot, or link to a repository

image

CMLCNL avatar Aug 17 '24 01:08 CMLCNL

hey @CMLCNL 👋 thanks for reporting. I'll work on this and let you know when a new version is released 🙏

ignaciosantise avatar Aug 20 '24 14:08 ignaciosantise

@CMLCNL Fix released on v2.0.2 🤝

ignaciosantise avatar Aug 20 '24 16:08 ignaciosantise