anza-xyz / wallet-standard

Solana extensions to the Wallet Standard.
Apache License 2.0
80 stars 42 forks source link

A hook that you can use to share a value (like a Promise) across your entire app, synchronously, as you would a ref #57

Closed steveluscher closed 2 months ago

steveluscher commented 3 months ago

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.

steveluscher commented 3 months ago

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @steveluscher and the rest of your teammates on Graphite Graphite

steveluscher commented 2 months ago

Merge activity