This positively abominable hook creates a global ref that multiple components can obtain and mutate. Mutating the value of current in one component not only mutates the value of current in all of them, but it forces a rerender of every participating component. Read the tests for more on how this works.
This hook will be used in https://app.graphite.dev/github/pr/anza-xyz/wallet-standard/58 to share the connect/disconnect promises across an entire app. Even if multiple components useConnectFeature() or useDisconnectFeature() they will operate on a single, unified connect/disconnect promise per wallet. This prevents things like the isConnecting property getting out of sync between multiple components, or multiple components calling connect() at the same time.
This positively abominable hook creates a global ref that multiple components can obtain and mutate. Mutating the value of
current
in one component not only mutates the value ofcurrent
in all of them, but it forces a rerender of every participating component. Read the tests for more on how this works.This hook will be used in https://app.graphite.dev/github/pr/anza-xyz/wallet-standard/58 to share the connect/disconnect promises across an entire app. Even if multiple components
useConnectFeature()
oruseDisconnectFeature()
they will operate on a single, unified connect/disconnect promise per wallet. This prevents things like theisConnecting
property getting out of sync between multiple components, or multiple components callingconnect()
at the same time.