Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes for auto connect state (MystenLabs#15061)
## Description While integrating the `useAutoConnectWallet` hook, I encountered two issues, which this PR fixes: - When using SSR, the initial state can disagree between with the client render. This is easy to work around by forcing the initial state to be `idle`. - The `isDisconnected` condition in auto connect led to an issue, where after _attempting_ to connect the first time, this would become false (since we go from disconnected -> connecting). The query would then run with a different query key but immediately return `attempted` since `isDisconnected` is false. This would lead to the hook resolving to `attempted` before the connection attempt was done (this could cause UIs to churn if you depended on this hook result). ~~I opted to just remove this entirely, although we could also update this to depend on `isConnected` instead, if we want.~~ (**edit:** ended up adding `isConnected` to the query key to work around some crazy edge cases) ## Test Plan How did you test the new or updated feature? --- If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process. ### Type of Change (Check all that apply) - [ ] protocol change - [ ] user-visible impact - [ ] breaking change for a client SDKs - [ ] breaking change for FNs (FN binary must upgrade) - [ ] breaking change for validators or node operators (must upgrade binaries) - [ ] breaking change for on-chain data layout - [ ] necessitate either a data wipe or data migration ### Release notes
- Loading branch information