What is best practice for user experience when sending a transaction? I was blocking UI with a spinner.
I am doing this:
//BlockUI
const sentTransaction = await sendTransaction(transaction)
persistTransactionInDB()
//UnblockUI
This is sometimes taking over 60 seconds to get a response with a transaction, and hence a transactionId I can use to track it.
I could do :
const regularTransaction = sendTransaction(transaction).then(res => persistResponse)
alert('well done, we'll let you know')
...but then if the user navigates away from the page then my function isn't executed?
What is the best way to do this?
Can I or should I somehow off load this to a worker or something?