Skip to content
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

reinitialize Providers #96

Open
edcalderon opened this issue Jul 1, 2023 · 4 comments
Open

reinitialize Providers #96

edcalderon opened this issue Jul 1, 2023 · 4 comments
Labels
feature request New feature or enhancement

Comments

@edcalderon
Copy link

the is a way to reinitialize the providers? without recompiling the project for switching networks on the fly like testnet mainet, I was trying to do it but I guess "useInitializeProviders" don't support this behavior thanks!

@drichar drichar transferred this issue from TxnLab/next-use-wallet Jul 4, 2023
@drichar
Copy link
Collaborator

drichar commented Jul 4, 2023

Currently no, initialization only runs once when the app mounts.

Your app supports switching networks on the fly? I usually think of different networks as being different environments, each with its own URL. Not saying one way or the other is better, just explaining the thinking behind the initialize-once approach.

I could see this being a feature added in a future release.

@drichar drichar added the feature request New feature or enhancement label Jul 4, 2023
@SilentRhetoric
Copy link

@drichar Per our chat about the "useNetwork" hook I created for https://github.com/SilentRhetoric/solid-algo-wallets, there are use cases for some dapps/tools in which a user may want to switch networks on the fly. Having a reactive way to change out the algodClient can enable the app to (mostly) seamlessly pivot to another network.

Of course, the user needs to have their wallet on the right network, and not all wallets work on all networks, so there are some possible UX snags. On balance, though, if a dapp wants to give the user the ability to switch networks, most wallets can cope with this and the library could offer it (perhaps optionally).

@drichar
Copy link
Collaborator

drichar commented Sep 25, 2023

💯 This is where my mind went with useNetwork or some equivalent feature. It's definitely not a limitation of the wallets themselves, but due to the way use-wallet currently handles network config. I'll have to see if there's a way to do it that's non-breaking.

@drichar
Copy link
Collaborator

drichar commented Jan 25, 2024

This will be possible in use-wallet v3, currently in development here: https://github.com/TxnLab/use-wallet-js

I'll keep this issue open for further discussion until the v3 full release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants