-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
2.14.7 regression store.query breaks some many2many relationships #5140
Comments
Does This isn't an answer to your issue, but if that's the case I'd amend the issue above to remove the section about link-to. Have you verified that the payloads returned from the backend are identical in all cases? |
Thanks @sandstrom, I have verified that payloads are identical where applicable, though the core of this issue is that calling |
I believe this is caused by #5086 (git bisect FTW) which was a bugfix in itself added by @stefanpenner I'm going to see if I can understand it enough to put some tests or event a fix together. |
fix has been backported, and will go out with: 2.14.11 + v2.15.0-beta.5 |
This issues doesn't exist in 2.13.2 - 2.14.6, it appears for the first time in 2.14.7 and still exists in 2.15.0-beta.4.
Sorry for the meandering ticket and all the leaky domain stuff from using my own API, not really sure what details might be important here.
I'm doing some pre-loading of relationships in my router to save network requests. In my route I have:
Which loads all the
objectives
that would be loaded with acourse.get('objectives')
. The goal is for them to then be available in the store without needing to fetch each one individually.This works as long as each
objective
returned only has a single course in its relationship likebut it seems to fail if there are more than one:
The result ends up being that the loaded
course
model somehow gets confused and thinks it is only linked to some of the objectives. Operations like{{#each course.objective}}
or{{course.objectives.length}}
or evencourse.hasMany('objectives').ids()
all provide incorrect data.This only happens when the route is visited directly (by refreshing the page or typing in the URL). If a
link-to
is followed (even one that uses anid
and not an object for the model then the relationships all load.I've tried to create a small reproduction of this, unfortunately I couldn't make it work with ember-twiddle but I have breaking code here:
https://github.com/jrjohnson/reproduction-ember-data-query-does-not-update-store
and a running app example at:
https://grader-duck-81038.netlify.com/
I've created three routes:
afterModel
hook used, works fineafterModel
hook used, breaksafterModel
hook, but loads a differentcourse
object withobjectives
that are only related to itself.(edited: added info that 2.15.0-beta.4 was tested)
(edited: I'm not sure where I got it wrong originally but this issues actually showed up in 2.14.7 for the first time.)
The text was updated successfully, but these errors were encountered: