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
Why fetch every time? #2355
Why fetch every time? #2355
Conversation
We might have the data in local storage then there is no reason to fetch it. When we add to cart then we update the local storage with the new information. If we don't have the content we can just get it. Why have the comments say session storage when it's local storage?
Please add a little changelog entry as described here. |
Codecov Report
@@ Coverage Diff @@
## trunk #2355 +/- ##
==========================================
+ Coverage 61.43% 61.46% +0.03%
==========================================
Files 3328 3329 +1
Lines 81910 81928 +18
==========================================
+ Hits 50323 50359 +36
+ Misses 31587 31569 -18
Continue to review full report at Codecov.
|
I like the try to save requests and traffic. But, I'm really not happy with this solution :-( This will lead to confused customers, when they are working through more than one device, while the cart is saved on account not browser :-) Short: not requesting the current cart regularly will result in wrong data shown in widget. EDIT: @raknison any reaction? :-) |
Hey @mrn-rigtved Sorry for the long delay and thank you for your contribution, but I am closing this PR, because as @tinect says, incorrect data is displayed if the current shopping cart is not queried regularly. |
1. Why is this change necessary?
We might have the data in local storage then there is no reason to fetch it.
If we don't have the content we can just get it.
Why have the comments say session storage when it's local storage?
2. What does this change do, exactly?
We only fetch if we don't have any data matching the key in local storage.
So we reduce the fetch requests.
3. Describe each step to reproduce the issue or behaviour.
I just made a page load on the landing page and some category pages then I saw we always call from this plugin.
5. Checklist