Improved Ember Data and Ember Changeset support for relationships
See original GitHub issueMain problem
Create a changeset with a model, set a belongsTo relationship, change a belongsTo, and lastly revert back to original - the changeset will be dirty
Support for ember-data relationship objects has been fraught with issues. Precisely and often with async (default) relationships in Ember Data. This is due to them being behind a Proxy, thus a === will fail with the same relationship.
This issue is to track (and keep me honest) in either implementing better support for ember data relationships or improved documentation.
One idea that is floating around is to use @embroider/macros to see if e-d is installed and then we can importSync the model and do an instanceof Model check. I’ll be exploring this space in the next few weeks.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:10
Top Results From Across the Web
Relationships and Changesets · Issue #551 - GitHub
Has there been any discussion on supporting relationships, such that the handlebars ... Are you trying to merge two ember-data objects? #543.
Read more >Relationships - Ember Data
Ember Data includes several built-in relationship types to help you define how your models relate to each other. One-to-One.
Read more >Ember Changesets - Michael Jan Schiumo - Medium
In essence, a Changeset is a proxy layer that prevents the corruption of data when changes are applied. This solves the issue of...
Read more >Bountysource
Improved Ember Data and Ember Changeset support for relationships. ... Coming soon: A brand new website interface for an even better experience!
Read more >ember-changeset - npm
The idea behind a changeset is simple: it represents a set of valid changes to be applied onto any Object ( Ember.Object ,...
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

Also here is a working implementation using the Reference API and extending ember-changeset. (thanks Oliver!)
@pernambucano (and anyone else who’s interested in this), consider sponsoring @snewcomer via Github sponsors, so he can spend more time on this library (ask your employer to pay). We sponsor him with $100 every month.