cardstack / ember-data-fastboot

Serializes and restores the ember-data store for fastboot
MIT License
52 stars 24 forks source link

Addon causes query calls to not make request #14

Closed arschmitz closed 6 years ago

arschmitz commented 7 years ago

I am using this addon in conjunction with the ember-data-has-many-query add on to query hasMany relationships. When i load the primary model in fastboot but then call query on the the has many from the client no request is ever made. If i remove this addon it works as expected. I checked and made sure that ember-data-has-many-query is calling reload so a request should be made.

arschmitz commented 7 years ago

Ok so after much digging i found the root cause of this would be happy to work on a PR but not really sure where to start. So the JSON api i use returns links for hasMany relationships not the actual array of id's normally ember-data looks for the presence of this link to determine if it should load individual records by ID or to load the link. Because the link is not preserved calls to load this relationship attempt to load by ID instead of link unless i first reload the base record so that the link is found

arschmitz commented 7 years ago

Also this happens regardless of the use of ember-data-has-many-query this happens for any attempt to load a relationship on a previously stored record created by this addon

MartinMalinda commented 7 years ago

@arschmitz if I understand this correctly the issue is that the link is not saved to the shoebox?

arschmitz commented 7 years ago

@MartinMalinda yup i just added a PR fixing this