Disable the swaps submit button after the first time it is clicked#10162
Disable the swaps submit button after the first time it is clicked#10162
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Builds ready [ce22267]
Page Load Metrics (575 ± 46 ms)
|
| </div> | ||
| <SwapsFooter | ||
| onSubmit={() => { | ||
| setSubmitClicked(true) |
There was a problem hiding this comment.
I noticed that this never gets set back to false if the signAndSendTransactions throws an error. I artificially introduced an error and tested it out, and it just hangs with the button disabled.
We should instead show an error message and let the user retry. Or if we recognize the error as indication that the swap will almost certainly fail, then show an error and abort the swaps flow.
I think this can be dealt with separately from this PR though. This flow didn't work very well before this PR either - I don't think it's appreciably worse now.
Though it would be good to track improving this. I'd like to have a generic error page added to every flow if possible, so we have somewhere to navigate the user to explain what happened before bringing them back to home.
This PR prevents an accidental submission of two swaps that could be caused by clicking the submit button a second time before the user is rerouted to the awaiting swaps screen.