-
-
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
hasMany association with links causes backtracking re-render error #4942
Comments
@stefanpenner @runspired here ya go! Let me know if there's any more info that would be useful. |
I can reproduce this on 2.14, but not on 2.13.2. My json-api data doesn't have links, just data and includes |
I think #5017 is the same |
In #5023 I created a working example app demonstrating the problem. |
Same problem here! Ember Data |
We are having the exact same issue in all of our applications when it auto-updated to 2.14.*. We've reverted back to 2.13.1 and it fixed the issue. |
This is happening for me when accessing a related model property in a template: |
Same issue, i upgraded an app this afternoon (for a client, i dont know tons about it) but i do know that upgrading from ember-data@2.13.x -> ember-data@2.14 caused 8 re-render errors in 2 templates where the templates did async relationship lookups, aka, i put them in a gist, with the errors(too long for here) https://gist.github.com/eriktrom/6174fbabf1d6bf35cd65ee6ea9f34266 just fyi (i dont know enough about the app to give further context, it was an afternoon upgrade) Note: its not using json-api, so links are not the issue, it actually uses "active-model-adapter": "2.1.1" addon (which is older i know, but not complicated, and based on rest adapter IIRC) |
Also having the same issue with a brand-new and incredibly simple app. Can't do things the guides say you can, like:
I will try rolling back to 2.13, but based on the description above I'm pretty confident that will do it. I'm using JSONAPI, but this happens whether it's async, |
Can confirm (on versions after import Ember from "ember";
export default Ember.Route.extend({
model(params) {
return this.store.findRecord("blogs", params.blog_id, {
include: "comments",
});
},
}); and a template: <ul>
{{#each model.comments as |comment|}}
<li>{{comment.body}}</li>
{{/each}}
</ul> And the exception is thrown on blogpost model
import DS from "ember-data";
export default DS.Model.extend({
name: DS.attr(),
reports: DS.hasMany("comment"),
}); comment model
import DS from "ember-data";
export default DS.Model.extend({
text: DS.attr(),
database: DS.belongsTo("blogpost"),
}); The JSONAPI response for include query
{
"data": {
"attributes": {
"name": "whatever"
},
"id": 1,
"links": {
"self": "/api/blogposts/1"
},
"relationships": {
"reports": {
"data": [
{
"id": "1",
"type": "comments"
},
{
"id": "2",
"type": "comments"
}
],
"links": {
"related": "/api/blogposts/1/comments"
}
}
},
"type": "blogposts"
},
"included": [
{
"attributes": {
"text": "blablabla"
},
"id": 1,
"links": {
"self": "/api/comments/1"
},
"relationships": {
"blogpost": {
"links": {
"related": "/api/blogposts/1"
}
}
},
"type": "blogposts"
},
{
"attributes": {
"text": "foobar"
},
"id": 2,
"links": {
"self": "/api/comments/2"
},
"relationships": {
"blogpost": {
"links": {
"related": "/api/blogposts/1"
}
}
},
"type": "blogposts"
},
],
"links": {
"self": "/api/blogposts/1"
}
} |
@vasa-chi Are you sure about that version? Everyone in here only has problems from 2.14.0 onwards. |
@buschtoens sorry, I meant on versions after |
Well, I'm still getting it after having rolled back all the way to 2.13.0 ... which makes me wonder if I'm doing something else wrong, but if so I can't see what. The application is so early and so simple--there is nowhere that I'm modifying the model objects--period--except for traversing to async relationship properties. All I have to do is access
And here's my template:
Which works fine... But if I change the
I get:
And that's on 2.13.0. I tried to make an ember-twiddle, but I don't see how to make one with a JSONAPI data source or even fixtures...could be missing it. |
@SphtKr you can use the Mirage boilerplate for that: https://ember-twiddle.com/eedfd390d8394d54d5bfd0ed988a5d0f |
- Pin ember-data to ~2.3.0 until emberjs/data#4942 is fixed
Is this a bug within Ember-Data or is this an issue with our code? And if it is an issue with our code, how can we fix it? For me it is really hard to spot the problem. Sometimes it obvious but sometimes it is very hidden. Especially in a big application like ours. We develop with Ember since more than three years and so our code base is quite big. |
@tschoartschi most likely a bug if you're not using anything that's private or undocumented. You can just use 2.13 until it's resolved. |
This a prime example of how horrible things have become in ember-data. @rlivsey reported this issue 4 months ago when it first hit in Canary. Nothing was done, this mishap went to Beta. People continued to report it, nothing was done, it shipped. Ember folks always say "test your apps on beta/canary and report issues". A lot of good that did. |
@RGL9032 A lot of hours (both in and out of work), between various members of the data and core team, have been spent fixing issues with the branch that eventually became 2.14.
There are many issues we don't know about, and @rlivsey has reported (and/or fixed) many of them! We do appreciate any contributions when people report issues. While we haven't gotten to this issue yet, we are working on fixing it. I'm sorry we let this breaking behavior slip through, but testing on beta and canary has prevented hundreds of bugs/regressions from getting out into the wild. You can always pin to a previous release if this change breaks your app. We'll be backporting fixes to 2.14 as we can as well. Ember is and always has been on a volunteer basis. Everyone in this thread has contributed useful debugging info, or constructive questions. I'm not sure what you wanted to get out of posting comments like this, but it doesn't help us debug or prioritize issues. |
Running against Canary I'm getting the following error when a has many relationship with links is used in a template:
Looks like
updateLink
is notifying property change and causing Glimmer to re-evaluate the relationship and so it explodes.I narrowed it down to when #4821 was merged, which makes sense as I assume that the links was previously resolved in advance but not happens when it's accessed.
Here's a twiddle which will hopefully demonstrate it, I can't get it working against ember-data canary as I get an error of "No application initializer named 'store'"
The text was updated successfully, but these errors were encountered: