Provider ready state won't change to true until I manually call start()..... #4264
Replies: 2 comments 8 replies
-
Is this regarding sub-classing the JsonRpcApiProvider in v6? There are a few reasons, and it is somewhat involved, I do need to add better docs on sub-classing, but I will try to cover some of the design decisions here. :) The Provider will automatically detect the network, if no explicit network is provider, which is a network call. I try not to dispatch any network traffic prior to an actual request from the network (such as a getBlockNumber), which would then trigger the network detection first. Many applications create a provider “just in case” and end up not using it, so this protects them from unnecessary network traffic. For the HTTP transport, it is simply called automatically from the send; calling it more than once will not affect anything. For some transport layers, like WebSockets, the provider is actually not able to make requests until some set up is complete and the socket is open (see here for an example). Does that make sense? It’s really just a way to provide sub-classes with more control over the control flow of transport setup… |
Beta Was this translation helpful? Give feedback.
-
to reproduce the error I just delete the check if (provider) from the useEffect
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Why does it happen? What does it mean? Right when I added the check, the state changed to true by itself. and then it stopped doint that, so I had to go read docs and find out about the start() call. But I guess it's not the most correct way to call it manually? Thanks:)
Beta Was this translation helpful? Give feedback.
All reactions