-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Magento_Customer/js/customer-data empty on the first page after login #21548
Comments
Hi @AymericJoubert. Thank you for your report.
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
For more details, please, review the Magento Contributor Assistant documentation. @AymericJoubert do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?
|
@magento-engcom-team give me 2.3-develop instance |
Hi @AymericJoubert. Thank you for your request. I'm working on Magento 2.3-develop instance for you |
Hi @AymericJoubert, here is your Magento instance. |
Can't reproduce it without adding provided piece of javascript, and need sample datas |
@magento-engcom-team Same or similar issue here on 2.2.7. In my case, it cases infinite loading of a product page due to failure of loading customer data. |
@magento-engcom-team give me 2.2.7 instance with sample data and frontend access |
Hi @Ctucker9233. Thank you for your request. I'm working on Magento 2.2.7 instance for you |
Hi @Ctucker9233, here is your Magento instance. |
So what's the roadmap about this issue ? |
@AymericJoubert expected result is wrong, customer data is loaded asynchronously. You can add observable on it to perform some logic when customer data is loaded. |
Try something like this: |
subscription to customer data is not being executed when Local Storage has mage-cache-storage: {} @AymericJoubert give a try to following patch
I could reproduce this following way:
|
Hello. I'm a new programmer in Magento 2, but I want to give my contribution to the post. Maybe I'm not providing the best solution, but could help someone. The data stored by the customerData js feature could be updated asynchronously and explicitly registering a subscriber solve the problem pointed by AymericJoubert. Using the code that he posted, add the following:
So, that way, when the customer data is updated, our widget or component receive the updated data and could does our logic verifications. It solved the problem to me of not verifying correctly the customer data on the first page load after login, because that code run asynchronously when the data is updated. Hope that helps. |
Customer data is empty on the first page after login.
Related to closed issue #13984, with more steps to reproduce.
Preconditions (*)
Steps to reproduce (*)
console.log(customer());
gives"{}"
in consoleconsole.log(customer());
gives right infos in consoleExpected result (*)
Actual result (*)
The text was updated successfully, but these errors were encountered: