fix: useAppKitProvider not reactive to switchNetwork (#5453)#5654
Closed
rtomas wants to merge 1 commit into
Closed
fix: useAppKitProvider not reactive to switchNetwork (#5453)#5654rtomas wants to merge 1 commit into
rtomas wants to merge 1 commit into
Conversation
Subscribe to ChainController state in the React hook and add an activeCaipNetwork subscribeKey listener in the Vue hook so consumers re-render after switchNetwork even when the provider reference is unchanged across chains within a namespace. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: d045bc1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 26 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
9 Skipped Deployments
|
Contributor
Visual Regression Test Results ✅ PassedChromatic Build: https://www.chromatic.com/build?appId=6493191bf4b10fed8ca7353f&number=880 👉 Please review the visual changes in Chromatic and accept or reject them. |
Contributor
📦 Bundle Size Check✅ All bundles are within size limits 📊 View detailed bundle sizes> @reown/appkit-monorepo@1.7.1 size /home/runner/work/appkit/appkit > size-limit |
Contributor
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
useAppKitProvider(React + Vue) was not re-rendering afterswitchNetworkbecause the provider reference is intentionally shared across chains within a namespace, and the React hook only subscribed toProviderController.state, while the Vue hook only subscribed viaProviderController.subscribe. Consumers wrapping the provider in chain-bound objects (e.g. ethersBrowserProvider, or any cached chain-bound helper) had no signal to reconstruct after a network switch. The fix adds auseSnapshot(ChainController.state)in the React hook and aChainController.subscribeKey('activeCaipNetwork', ...)listener (with cleanup) in the Vue hook, so consumers re-render on switchNetwork even when the provider reference stays the same.Type of change
Associated Issues
closes #5453
Showcase (Optional)
N/A — DX-only fix, no UI change.
Checklist