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

Refactor Wordle hooks #18

Merged
merged 2 commits into from
Nov 7, 2024

Conversation

rccsousa
Copy link
Collaborator

@rccsousa rccsousa commented Nov 7, 2024

Why

Wordle3 hooks were using a local account strucutre that had to destructure the account into account.address in order to separate address and private key which is not what will happen in production.

How

By refactoring the hooks' argument to stop destructuring the account as WagmiProvider passes the correct data structure to work as intended.

## Why
Wordle3 hooks were using a local account strucutre that had to
destructure the account into `account.address` in order to separate
address and private key which is not what will happen in production.
## How
By refactoring the hooks' argument to stop destructuring the account as
`WagmiProvider` passes the correct data structure to work as intended.
## Why
The `useEffect` hook was constantly pinging the network while looking
for changes in `playerGuesses` which lead excessive network requests.
## How
By changing the `useEffect` to watch only for address changes and
shifting the `playerGuess` update to `handleTryGuess`, which makes more
sense.
@rccsousa rccsousa merged commit 751f332 into rs/add-wallet-client Nov 7, 2024
2 checks passed
@rccsousa rccsousa deleted the rs/refactor-smart-contract-hooks branch November 7, 2024 12:15
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