-
Notifications
You must be signed in to change notification settings - Fork 0
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: Browser back button error in Payment page #3
base: master
Are you sure you want to change the base?
Conversation
…app-payment into zubair-back-button-fix
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.
Are there any tests that can be updated here to reflect this new behavior?
Let me look into it if we can add any. Thanks |
src/payment/data/reducers.js
Outdated
case BASKET_DATA_RECEIVED: return { ...state, ...action.payload }; | ||
case BASKET_DATA_RECEIVED: | ||
if (action.payload.products && action.payload.products.length > 0) { | ||
localStorage.setItem('sku', action.payload.products[0].sku); |
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.
Noted you have new code to handle baskets with more than 1 product.
Apart from that, I don't think it's recommended to directly update localStorage
within reducers, as they should be pure functions, without any side effects.
You can update it instead within the PaymentPage
component or in actions.
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.
Alright 👍 I'll update the code accordingly. Thanks
} else { | ||
this.props.fetchBasket(); | ||
sendPageEvent(); | ||
} |
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.
Have a couple of questions:
- Can you make this logic specific to PayPal? We don't want the window location to be set to another URL for Stripe purchases.
- Have you tested that regular credit card (Stripe) purchases work?
- Have you tested what happens on re-load of the page?
Also, continuing on the other comment I added, you could dispatch an action from this component to set localStorage
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.
Regarding point 1 I'll update the code so it is specific to PayPal only.
Point 2. Yes I've tested regular credit card purchases
Point 3. On page reload a new basket is created that contains courses/program user was about to purchase. Previously new empty basket was created.
Anyone merging to this repository is expected to promptly release and monitor their changes; if you are not able to do this DO NOT MERGE, please coordinate with someone who can to ensure that the changes are released.
Description
Supporting information
Testing instructions
Other information
Checklist