Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's the purpose of this pull request?
Fix a loop bug on toast: when adding more units than the max allowed for a product, a toast was shown and the cart was changed automatically decreasing the quantity to the max, but the toast kept being shown because the orderform would still have the message.
Also fixed another bug on toast: when adding a product and then changing the zip code that doesn't deliver that product, the toast wasn't being shown.
How it works?
For the first case: cleaning the orderform messages
clearOrderFormMessages(orderNumber, ctx)
fixes the loop.For the second case: making
validateCart
check changes in the orderform messages field fixes the issue. The toast in this case will only stop being shown if the user changes the zip code to a valid one or remove the item from the cart.How to test it?
First case:
1.mov
Second case:
2.mov
Starters Deploy Preview
References
Slack thread