fulls1z3 / ngx-cache

Cache utility for Angular
MIT License
154 stars 16 forks source link

determine whether cache.keys is undefined #55

Closed luffySAMA closed 6 years ago

luffySAMA commented 6 years ago

I'm submitting a ... (check one with "x")

[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  <!-- Please check the repository for a similar issue or PR before submitting -->
[ ] Support request => <!-- Please check the repository for a similar issue or PR before submitting -->
[ ] Feature request
[ ] Documentation issue or request

Current behavior when I first run node dist/server.js, I got this error

stack:"Error: Uncaught (in promise): TypeError: Cannot read property 'indexOf' of undefined
TypeError: Cannot read property 'indexOf' of undefined
    at CacheService.has (/Users/caihuapeng/work/angular-universal/dist/server.js:25511:32)
    at Cache.has (/Users/caihuapeng/work/angular-universal/dist/server.js:19277:27)
    at ApiService.post (/Users/caihuapeng/work/angular-universal/dist/server.js:14047:24)
    at DomainService.getDomainConfig (/Users/caihuapeng/work/angular-universal/dist/server.js:20623:14)
    at LocationService.getCityList (/Users/caihuapeng/work/angular-universal/dist/server.js:195:35)
    at new LocationService (/Users/caihuapeng/work/angular-universal/dist/server.js:149:14)
    at _createClass (/Users/caihuapeng/work/angular-universal/node_modules/@angular/core/bundles/core.umd.js:9565:20)
    at _createProviderInstance$1 (/Users/caihuapeng/work/angular-universal/node_modules/@angular/core/bundles/core.umd.js:9535:26)
    at resolveNgModuleDep (/Users/caihuapeng/work/angular-universal/node_...

then I run on debug mode ,and it seems that the error occurs in CacheService.has Function because this.cache.keys is undefined debug info

luffySAMA commented 6 years ago

Oh,I deleted the .cache folder and the problem is sovled. I don't know how to reappear this bug, and I think it's my problem