-
Notifications
You must be signed in to change notification settings - Fork 10
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
5. Get the check-in count from the BatchRegistry contract #6
Comments
working on this |
This should take advantage of the isLoading state returned by useScaffoldReadContract. That would eliminate the need for the isNan() check |
@RafaelCaso maybe we can do it like this? const result = isLoading ? "..." : Number(checkedIn); I'm still not sure if with the above we can simplify the codes for showing the <span className="font-bold">Checked in builders count: {result}</span> |
yeah, replacing Number.isNaN(result) with isLoading makes more sense to me. if checkedIn fails it would be because of an error from the block chain, no? So maybe we would add a catch block and return a simple "Something wen't wrong, please try again" kind of message? |
@RafaelCaso Maybe you can write and do PR then ask your questions in the PR and people who are more knowledgeable can give more insights. It is kind of hard not having real codes to check and do stuff 😁 |
@RafaelCaso and @indralukmana, I definitely appreciate the conversation about error handling! We want users to have a good experience, even when things go wrong.
useScaffoldReadContract is a wrapper around wagmi's useReadContract, which has return fields related to possible errors and failureReasons. These are definitely worth learning as a FE developer reading blockchain data!
Back to our implementation, giving the user information like this is a great idea. Displaying more info about the error on the page or in a toast is a common pattern for good reason. Start simple by handling all errors in the same way, then add complexity for (displaying) different error reasons one at a time. |
PR is in |
Goal
There is a "To Be implemented" string in
packages/nextjs/app/page.tsx
that should show the number of builders that have checked in to the contract.We want to show the real count (reading from the BatchRegistry contract)
For more info about the contract: #10
The text was updated successfully, but these errors were encountered: