-
Notifications
You must be signed in to change notification settings - Fork 156
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
Cannot read property 'maxAge' of undefined #36
Comments
I see the missing null check on that line, but I'd like to reproduce the problem and see if the root cause isn't elsewhere. Can you show an example of how to reproduce it? |
The only way this bug can occur is if |
if it helps, I have been clearing out entries from localstorage using chromes developer tools. maybe that makes things go haywire. though i have allways deleted both the data and keys entry. |
That could very well have been the problem. Angular-cache namespaces all of the entries it puts into localStorage so it doesn't stomp on whatever other things might be using localStorage. Also, I don't serialize the entirety of angular-cache's internal state to localStorage, only the the key-value pairs. When angular-cache loads it rebuilds its internal state from the key-value pairs. If the key-value pairs are removed from localStorage by some other party while angular-cache is still running in memory (there hasn't been a page refresh) then that would cause angular-cache's internal state to become out of sync with what is in localStorage. I'll have to look into writing some safe guards to handle this situation. Thanks for bringing it to my attention. |
I will try out the fix tomorrow and see if the bug has gone away! Thanks! |
I closed one loophole, but see #39 for what may yet be an unsolved issue (and less easy to fix). |
Somehow maxAge isn't set.
The offending line is:
angular-cache/src/angular-cache.js
Line 557 in 7383686
they key is set, but data is an empty object.
Maybe we need to put in a null check for maxAge?
The text was updated successfully, but these errors were encountered: