Cache not responding
See original GitHub issueWhen I clear the browser cache, enter my store’s home page and then navigate to any category or product page I get the error message “Cache not responding”. After this happens and I check Application > IndexedDB in Chrome I can see that nothing gets added to the database. For example, if I try to add something to the cart I can see that it’s not added in the database. I can place an order in the checkout but it’s not sent to the backend for processing at all. It’s not found in syncTasks either.
Refreshing the page solves the problem. The problem appears in my dev store running v1.0.5 and the vue storefront demo page. I haven’t checked if it’s present in developer build.
I tried looking into the problem myself and found out that something seems to happen in lib/search.js in the function quickSearchByQuery
. If I call ready()
on global.$VS.db.elasticCacheCollection._localForageCollection
I can see that the promise is pending and not resolved at the time getItem
is called.
I used the promise from ready()
and placed the whole cache.getItem
block inside the then() part and this solved the problem. IndexedDB shows items as expected, no error message and no refresh needed.
I’m new to JS and Vue development so I’d appreciate if someone more experienced could look into this and maybe find a better solution or explain what happens. But it seems like elasticCacheCollection is just not ready when it’s called? Is there a better way to wait for it?
Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
Top GitHub Comments
You’re probably right 😃 I’ll try your solution instead and see if it works. Thanks!
Thanks! Without Your observation i wouldn’t have fix it! 😃