Loading lazy associations via Related Resource Links causes association to be dirty
See original GitHub issueI’ve managed to isolate the issue I was seeing when I commented on #28.
When an association is loaded via a related resource link and there is no data linkage for this association (i.e. missing the ‘id’ and ‘type’) then the association is considered to be changed, thus dirtying the model.
JSON API example e.g.
{
"data": {
"type": "project",
"attributes": {
"title": "Project1"
},
"id": 1,
"relationships": {
"company": {
"links": {
"related": "/projects/1/company"
}
}
}
}
}
I’ve written a breaking test for belongsTo and hasMany associations to demonstrate the problem. I’ll push it to a branch shortly
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
5 ways to initialize lazy associations and when to use them
Initializing an association the right ways makes the difference between horrible and great performance. Here are 5 different ways and when to use...
Read more >How to tell if a relationship has been loaded #5629 - GitHub
Loading lazy associations via Related Resource Links causes association to be dirty danielspaniel/ember-data-change-tracker#66.
Read more >5 ways to initialize lazy associations and when to use them
Lazy loading of associated entities is a well-established best practice in JPA. Its main goal is to retrieve only the requested entities ...
Read more >6 Object Relational Mapping (GORM) 3.0.16
They are linked together through relationships; one-to-one, one-to-many, or many-to-many. GORM is Grails' object relational mapping (ORM) implementation.
Read more >The best way to handle the LazyInitializationException
For this reason, it's better to use LAZY associations. A LAZY association is exposed via a Proxy, which allows the data access layer...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sure thing @richardfrosztega , best thing is to clone this repo, and make a PR for your branch in your repo against mine. Thanks for working on it. I appreciate it and others will too.
I’ve been working on a fix based on this from inside ember data
Relationship
I just need some time to tidy it up from POC to production ready. Once I’ve got it together would you like me to put it on a branch @danielspaniel?