-
Notifications
You must be signed in to change notification settings - Fork 4
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
Handle Wait for transaction when user gets disconnected #46
Comments
Secondly, how else could I use useWaitForTransaction so that I am able to set loading state elsewhere allowing me to show loaders on the page? |
From what I can tell, the refresh case would need to be solved through means outside of this library. I can easily add a For displaying loading state while you |
So you are suggesting that I can store the transaction to localstorage and then create a component like this. const Page = () => {
const [transaction, setTransaction] = useState()
useEffect(() => {
const tx = getTransactionFromLocalStorage()
setTranasction(tx)
}, [])
const SubmitButton = () => {
// would this throw error if transaction is undefined?
useWaitForTransaction(transaction)
return <button>Submit</button>
}
return <Suspense fallback={<>Loading</>}><SubmitButton /></Suspense>
} |
I'll try to put together an example to demonstrate this next week, it'll require the addition of a new |
I was looking at ways to handle situations where we want to display a loader to the user if their transactions is currently ongoing.
we can use
useWaitForTransaction
for that. However, how do we handle the case, if the user refreshes the page?Ideally, I want to be able to fetch user's pending transactions and display a UI suitable to my needs.
What's your thought on this?
The text was updated successfully, but these errors were encountered: