-
Notifications
You must be signed in to change notification settings - Fork 55
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
(Bug) #1052 Prevent to run multiple transaction #1053
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- send should be immediate, we don't await for it. if there's a button double click issue, you need to disable the button on click. I think we already implemented this somewhere. maybe add it as a feature to all buttons
- yaroslav already did a pr that checks if feeditem is undefined, we should not have undefined items, double check his previous fix for undefined. it could also be solved by the latest gun fix I've pushed.
we already have a disable button here. it is |
I've added just filter |
|
|
I think the problem was with duplicate transactions when I press |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yaroslav-fedyshyn-nordwhale @AlexeyKosinski we have to ways 2 send GD
- directly
- via payment link
@yaroslav-fedyshyn-nordwhale @AlexeyKosinski also please check all buttons functionality and how we can prevent double clicking issues |
@sirpy we already have the functionality to prevent double-clicking. We can block the button to be clicked multiple times by passing the 'loading' (boolean) property to the CustomButton component. It was already implemented in the place we had an issue, but the setLoading(false); was called in 'finally' clause of 'try' block, so the button was unlocked without waiting for any transaction response. That is why we could confirm multiple times. After we place the setLoading(false) to the correct place (after the response received) - confirm button will be unlocked correctly. I checked the button across the app and didn't find the same behavior. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in SendLinkSummary.js i dont see any usage of loading.
scenario seems the same to me, user clicks confirms and a tx is generated. dont see how loading is implemented there
We don't need loading there as after the user press confirm button he will be redirected to next step or share dialog will be shown in case of mobile. The hash we waiting from onTxHash callback needed just to create a feed card (async). |
@sirpy I pushed new commit |
# Conflicts: # src/components/profile/__tests__/OptionsRow.js # src/components/profile/__tests__/__snapshots__/OptionsRow.js.snap
({ paymentLink, code }) => (hash: string) => { | ||
log.debug({ hash }) | ||
const generateLinkResponse = goodWallet.generateLink(amount, reason, { | ||
onTransactionHash: ({ hash, paymentLink, code }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for special ontxhash
take paymetlink and code from generatelinkresponse
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/lib/wallet/GoodWalletClass.js
Outdated
@@ -560,7 +559,7 @@ export class GoodWallet { | |||
}) | |||
|
|||
//pass extra data | |||
const onTransactionHash = getOnTxHash({ paymentLink, code }) | |||
const onTransactionHash = hash => events.onTransactionHash({ hash, paymentLink, code }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Description
Prevent users to click on the confirm button multiple times as then multiple transactions will be sent. The finally block was executed right after the try block as the result wasn't awaited. SO the fix is to wait for generateLink fn to be performed.
About #1052
How Has This Been Tested?
Create a receive link.
Use it with another account.
Go to the last/confirm step.
Try to press the confirm button quickly many times.
It should be disabled with a loader after the first press.
Checklist:
Video: https://www.screencast.com/t/VBuFHCgSI