-
Notifications
You must be signed in to change notification settings - Fork 682
Description
Describe the bug
When a user browses the site as a guest and then logs in, several GraphQL calls are executed with a stale or old cartId, which leads to errors in the Magento logs.
To reproduce
Steps to reproduce the behavior:
- Open the website in a guest session (not logged in).
- Log in with a registered user account.
- Check the next GraphQl in the browser inspector: getItemCount, MiniCartQuery
- See the error: The current user cannot perform operations on cart ...
Expected behavior
Merge the guest's cart with the customer's cart and correctly replace the guest's cartId with the new customer's cartId for all subsequent GraphQL calls. And avoid dispatch request with a stale cartId.
Screenshots
Screencast.from.2025-08-14.09-22-20.mp4

Possible solutions
Checking the talon useSignIn.js I can see that setToken is called before clear cart and customer data.
If setToken is moved after deleting that data the errors is not thrown.
Please complete the following device information:
- Device [Notebook]:
- Browser [Chrome]:
- Browser Version [Version 138.0.7204.100 (Official Build) (64-bit)]:
- Magento Version [Adobe Commerce 2.4.7-p6]:
Please let us know what packages this bug is in regards to:
-
venia-concept
-
venia-ui
-
pwa-buildpack
-
peregrine
-
pwa-devdocs
-
upward-js
-
upward-spec
-
create-pwa