-
Notifications
You must be signed in to change notification settings - Fork 9
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: APP-410 save buy flow on last user interaction #2574
base: dev
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for regen-website ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for terrasos ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@erikalogie see testing instructions |
LGTM |
fef3652
to
0b294da
Compare
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.
Two additional comments:
- We don't save values for the last step to local storage
- When using credit card, if the user leaves the page while being on the last step, when he comes back, we should go back to step 2 (Payment info) because we need the user to re-enter credit card info since this is something we can't save to local storage of course
...data, | ||
creditsAmount: _creditsAvailable, | ||
currencyAmount: _spendingCap, | ||
sellOrders: orderedSellOrders, |
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.
why aren't we setting this to the same value as in setValue(SELL_ORDERS, ...)
just above?
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.
Good you noticed this, thanks
{ | ||
...data, | ||
creditsAmount: currentCreditsAmount, | ||
currencyAmount: currencyAmount, |
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.
why not updating sellOrders too?
{ | ||
...data, | ||
creditsAmount: currentCreditsAmount, | ||
currencyAmount: isNaN(value) ? 0 : value, |
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.
ditto
updateMultiStepData( | ||
{ | ||
...data, | ||
currency, | ||
paymentOption, | ||
currencyAmount: 0, | ||
}, | ||
activeStep, | ||
); |
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.
why is this needed?
we update the currencyAmount but not the sell orders which depend on it, which could lead to inconsistent data in local storage
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'm updating the multistep data here to keep it in sync with the input field, don't you think this needs to be done?
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'm not sure since it seems like this will be updated anyway from handleCurrencyAmountChange
with the correct values for corresponding sell orders and credits input
name: form.watch('name'), | ||
email: form.watch('email'), |
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 believe form.getValues
https://react-hook-form.com/docs/useform/getvalues would be more appropriate in this case, since we don't need to subscribe to value changes in this function
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.
You are right
Description
https://regennetwork.atlassian.net/browse/APP-410
Now when users interact with the forms the information should be stored in the localstorage automatically even when the next button hasn't been clicked yet, and therefore, on navigating away and back to the same page, users should be in the same step and see the same form data as before navigating away.
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
How to test
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...