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

Nest Include breaks CacheStore#setCollection #129

Closed xaun closed 5 years ago

xaun commented 5 years ago

Is the nested include supported?

.all({ include: 'comments.author' })

On version 1.1.1 when trying to query with the above it breaks with stack trace:

marketplace.component.ts:27 TypeError: Cannot read property 'data' of undefined
    at eval (ngx-jsonapi.es5.js:1956)
    at Array.forEach (<anonymous>)
    at eval (ngx-jsonapi.es5.js:1955)
    at eval (ngx-jsonapi.es5.js:351)
    at Array.forEach (<anonymous>)
    at Function.Base.forEach (ngx-jsonapi.es5.js:350)
    at CacheStore.setCollection (ngx-jsonapi.es5.js:1952)
    at eval (ngx-jsonapi.es5.js:2355)
    at ZoneDelegate.invoke (zone.js:388)
    at Object.onInvoke (core.js:4760)

The resource_type_alias is "comments.author", so resource.relationships[resource_type_alias].data can never work.

xaun commented 5 years ago

Sorry, accidental duplicate of https://github.com/reyesoft/ngx-jsonapi/issues/128