-
Notifications
You must be signed in to change notification settings - Fork 356
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
fix: revalidate recipient field on account change in the send flow #8621
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 4 Skipped Deployments
|
7cbc1de
to
466d115
Compare
@@ -48,6 +48,21 @@ const RecipientField = <T extends Transaction, TS extends TransactionStatus>({ | |||
} | |||
}, []); // eslint-disable-line react-hooks/exhaustive-deps | |||
|
|||
useEffect(() => { |
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.
wdyt about combine both useEffect ? With something like that?
useEffect(() => {
if (value !== "" && value !== transaction.recipient) {
onChangeTransaction(bridge.updateTransaction(transaction, { recipient: value }));
if (resetInitValue && initValue) {
resetInitValue();
}
}
}, [
value,
transaction.recipient,
bridge,
onChangeTransaction,
transaction,
initValue,
resetInitValue,
account.id,
]);
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.
i did before, it didn't work (especially when you switch multiple time the same crypto accounts). if (resetInitValue && initValue)
is not a valid condition to reset the initValue. Also the first effect will run one single time at the component mount. What i need is a second layer that manages the change of account.id basically. I would rather ignore exhaustive deps.
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.
what you recommend as a refactor is a better abstraction, but with an uncontrolled resetInitiallValue, it gaves me a different behaviour.
466d115
to
caa6b2f
Compare
✅ Checklist
npx changeset
was attached.📝 Description
See the following video
Before
before_revalidation.mov
Note: in the end of the video, i was forced to delete and re-paste the casper address so that it can be revalidated via the input onChange event.
After
after-revalidation.mov
Note: here the revalidation is controlled by both input onChange event and watching the account.id change from the selector above.
❓ Context
https://ledgerhq.atlassian.net/browse/LIVE-14904
🧐 Checklist for the PR Reviewers