[4.x] Auto retry requests where the cart has expired#1236
[4.x] Auto retry requests where the cart has expired#1236
Conversation
|
|
||
| return await window.magentoGraphQL( | ||
| query, | ||
| { ...variables, cartId: mask.value, cart_id: mask.value }, |
There was a problem hiding this comment.
Unfortunately some requests have cartId and others have cart_id. This was the simplest and most readable way to catch both.
indykoning
left a comment
There was a problem hiding this comment.
Code wise it's looking good.
But perhaps we can simplify it a lot by doing what we are doing in the useUser store:
core/resources/js/stores/useUser.js
Line 214 in 08c16ce
I reckon refreshing the cart after loading the page will tackle most of the problems users experience.
This would move the error to the page load instead of the add to cart. It'd probably be cleaner, but it would not solve the issue of the users getting put off by a weird error. We could perhaps combine the two to make the error silent on page load and immediately create a new cart when necessary? |
|
I agree, we probably should silence the error if it happens during the "page load request" |
d8ba6ff to
e745578
Compare
indykoning
left a comment
There was a problem hiding this comment.
Your tests are failing, other than that LGTM
Yeah something with text rendering going weirdly, I'm not sure why. The part where I changed the playwright tests didn't do anything to change that. |
f024ece to
e745578
Compare
|
Error fixed by reverting the change, but now the screenshots are still slightly off with the font rendering. |
c0e5a9b to
ebbf244
Compare

ref: RAP-1854, BORDEX-1358
Currently, when your cart expires you will sometimes get an ugly and scary error telling you your cart ID is not valid.
With this PR, I check for this error and underwater we retry the request once, adding a more friendly notification telling you that your cart has expired in the meantime. This means that, for example, if you add a product to your expired cart, it will make a new cart and then re-add the product to this new cart.
This makes the user experience for expired carts a bit nicer.