reyesoft / ngx-jsonapi

JSON API client library for Angular 5+ 👌 :: Production Ready 🚀
https://ngx-jsonapi.reyesoft.com/
MIT License
101 stars 52 forks source link

TypeError: Cannot set property 'attributes' of undefined on delete #192

Closed awakestu closed 5 years ago

awakestu commented 5 years ago

The issue is when trying to perform delete entity with given id possibly can be absent in cache. But it tries to get it and unconditionally set attributes to {} before deletion.

TypeError: Cannot set property 'attributes' of undefined
    at CacheMemory.push../node_modules/ngx-jsonapi/ngx-jsonapi/@ngx-jsonapi/ngx-jsonapi.es5.js.CacheMemory.removeResource (ngx-jsonapi.es5.js:1450)
pablorsk commented 5 years ago

Please, can you post a small example? Like https://github.com/reyesoft/ngx-jsonapi/blob/cd063ec3058898a0604c268f3188694495c0122a/demo/app/books/components/books.component.ts#L57-L59

For example, this code produce an error, rigth?

this.booksService.delete('inexistent_id');