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

feat(react): return isReconnecting from useWallet #330

Merged
merged 2 commits into from
Jan 16, 2025

Conversation

stefanofa
Copy link
Contributor

Added the isReconnecting state returned by useWallet in the react library.
This new state lets users know when a reconnect attempt is in progress.

@drichar
Copy link
Collaborator

drichar commented Jan 9, 2025

Sorry I missed this over the holidays! This is a useful feature, I like it 👍

For parity it should go in the other framework libraries as well (not just React). Is that something you'd be game to try here or would you rather I implement it in the Solid and Vue libs after merging?

@drichar drichar merged commit 4e138ba into TxnLab:main Jan 16, 2025
1 check passed
drichar added a commit that referenced this pull request Jan 17, 2025
Add `managerStatus` to track wallet manager initialization state and expose
`isReady` getter in React, Vue, and Solid implementations. This allows
consumers to know when the wallet manager has completed initialization
and is ready for use.

- Add `managerStatus` to `State` type and `defaultState`
- Add `status` and `isReady` getters to `WalletManager` class
- Remove `isReconnecting` from React implementation (see PR #330)
- Add `isReady` to all framework implementations
- Add tests for `isReady` behavior
@drichar
Copy link
Collaborator

drichar commented Jan 17, 2025

Thanks for this contribution @stefanofa! After waiting a bit to see if you wanted to tackle the expansion yourself, I went ahead and built upon your idea in #335.

I implemented the initialization state tracking at the core WalletManager level and exposed it as isReady across all framework adapters (React, Vue, Solid). I also flipped the boolean logic to be more intuitive – waiting for isReady to become true rather than waiting for isReconnecting to become false.

Thanks for getting this started!

drichar added a commit that referenced this pull request Jan 17, 2025
* feat(*): add isReady state to track manager initialization

Add `managerStatus` to track wallet manager initialization state and expose
`isReady` getter in React, Vue, and Solid implementations. This allows
consumers to know when the wallet manager has completed initialization
and is ready for use.

- Add `managerStatus` to `State` type and `defaultState`
- Add `status` and `isReady` getters to `WalletManager` class
- Remove `isReconnecting` from React implementation (see PR #330)
- Add `isReady` to all framework implementations
- Add tests for `isReady` behavior

* docs(react): update isReady state documentation

Replace `isReconnecting` with `isReady` in React quick start guide to reflect
the new unified approach to wallet manager initialization state across all
framework implementations. Update example code and description to be more
descriptive and user-friendly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants