fix eth_accounts calls on localNetwork #454
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Since we have
localWalletClient
as use effect dependency we get lot ofeth_accounts
because of this line :scaffold-eth-2/packages/nextjs/components/scaffold-eth/Faucet.tsx
Line 35 in 6370b4c
You can easily notice lot of
eth_accounts
while using SE-2 through CLI but for some reason onmain
it sometimes doesn't happens directly and if you addconsole.log("This is localWalletClient", localWalletClient)
below the abovepermalink
it will start makingeth_accounts
(😅 even I am confused about this behavior onmain
but I noticed on it on main)Nevertheless, I think it makes sense not to pass objects as dependency to
useEffect
Solution :
Move
localWalletClient
outside of the component this we don't need to pass it as a dependency.JSON.stringify doesn't work because
uid
is changing inlocalWalletClient