-
-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move state update call after networkClient is instantiated and added to registry in upsertNetworkConfiguration
#3679
Move state update call after networkClient is instantiated and added to registry in upsertNetworkConfiguration
#3679
Conversation
…tateChange messenger event can be safely used to identify when new networkClients have been added and are ready to be called to
Can you tell me what use case this is intended to solve? The network configuration has nothing to do with the network client. If you wanted to wait for the network configuration to change then the current state update works fine. If you wanted to wait until a network client was ready, that's what |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adonesky1 and I spoke more about this and I agree conceptually with this change, so I'm approving so we can merge this. I'll explain more in the next comment.
For more context, my concern with using network configuration to discern whether the provider for the newly added network is available comes from past troubles with There are a lot of places in our code that listen for NetworkController state change to know when the chain ID is changed. Sometimes they do this so they can keep data organized by chain in state, and sometimes they need the chain ID to feed it to some external service, but sometimes they do this as a way of knowing when the provider is updated so that they can reset an EthQuery or Web3Provider instance (something where there is definitely a better approach, but that's beside the point). They do this currently by listening to I see Besides this, there is the fact that while |
@metamask/network-controller
Changed:
NetworkController:stateChange
event can be safely used to identify when new networkClients have been added and are available for useChecklist