-
-
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
Implement dirty tracking and rollback of belongsTo relationships. #3698
Implement dirty tracking and rollback of belongsTo relationships. #3698
Conversation
b6612ce
to
aa04fcf
Compare
Any news on this? Would be great if releationships can rollback again. |
aa04fcf
to
febb27b
Compare
+1 |
@arenoir sorry for the delay, I'll make sure it gets discussed at this week's meeting. |
@igorT has agreed to write an RFC for relationship tracking. |
+1 on this issue |
03fb8b1
to
75e9f62
Compare
@fivetanley any word on this? fyi I rebased with master. |
👍 |
Please 👍 |
+1 |
I apologize for the long delays |
No worries @fivetanley, I look forward to the RFC. Perhaps I am beating a dead horse but @igorT would you take a look at the conversation I started regarding the difference between hasOne and belongsTo. I think it relates to the RFC you may be putting together. |
👍 this would be useful |
We all agree it would be useful. ;) |
👍 I've been implementing an re-implementing this for ages every time ember-data changes. It would definitely be useful. |
I'm going to close this pr. @igorT is working on an RFC to describe what needs to happen to for Ember Data to support relationship rollback for both |
@nanuxbe could you share to us in a gist? |
Any news on the before mentioned RFC? |
👍 Any news on the RFC? Would love to see this rollback for belongsTo resolved. |
How can we help get this issue fixed? What's the blocker? |
This is a huge pain point with ember data for us. Would love to see this merged. |
At risk of being "that guy": I'm struggling through this at present, and it feels a lot like I drove a car into a parking space only to find out the next day that the car can't reverse. I get that this is a hard feature to add, but I'm un-thrilled about the radio silence as of late. |
One solution for certain cases is to use ember-data-model-fragments. I found that to implement arrays of plain objects or primitive types I was modeling them as ember-data relationships, when I didn't really want or need the overhead of the ember-data object. |
Should this be called
|
This was marked "Needs Team Discussion" nearly two years ago. Was there a discussion on this? Is there anything that can be shared from the core team about this? As a long time ember user, it's just down right frustrating to see PRs with a lot of support sit without any feedback. |
This commit: 1. Allows one to rollback belongsTo and hasMany relationships. 2. Reintroduces dirtyRecordFor*Change hooks on the adapter that allow one to customize when a record becomes dirty. 3. Added 'removeDeletedFromRelationshipsPriorToSave' flag to Adapter that allows one to opt back into the old deleted record from many array behavior (pre emberjs#3539). Known issues: 1. Rolling back a hasMany relationship from the parent side of the relationship does not work (doing the same from the child side works fine). See test that is commented out below as well as the discussion at the end of emberjs#2881#issuecomment-204634262 This was previously emberjs#2881 and is related to emberjs#3698
This commit: 1. Allows one to rollback belongsTo and hasMany relationships. 2. Reintroduces dirtyRecordFor*Change hooks on the adapter that allow one to customize when a record becomes dirty. 3. Added 'removeDeletedFromRelationshipsPriorToSave' flag to Adapter that allows one to opt back into the old deleted record from many array behavior (pre emberjs#3539). Known issues: 1. Rolling back a hasMany relationship from the parent side of the relationship does not work (doing the same from the child side works fine). See test that is commented out below as well as the discussion at the end of emberjs#2881#issuecomment-204634262 This was previously emberjs#2881 and is related to emberjs#3698
This commit: 1. Allows one to rollback belongsTo and hasMany relationships. 2. Reintroduces dirtyRecordFor*Change hooks on the adapter that allow one to customize when a record becomes dirty. 3. Added 'removeDeletedFromRelationshipsPriorToSave' flag to Adapter that allows one to opt back into the old deleted record from many array behavior (pre emberjs#3539). Known issues: 1. Rolling back a hasMany relationship from the parent side of the relationship does not work (doing the same from the child side works fine). See test that is commented out below as well as the discussion at the end of emberjs#2881#issuecomment-204634262 This was previously emberjs#2881 and is related to emberjs#3698
This commit: 1. Allows one to rollback belongsTo and hasMany relationships. 2. Reintroduces dirtyRecordFor*Change hooks on the adapter that allow one to customize when a record becomes dirty. 3. Added 'removeDeletedFromRelationshipsPriorToSave' flag to Adapter that allows one to opt back into the old deleted record from many array behavior (pre emberjs#3539). Known issues: 1. Rolling back a hasMany relationship from the parent side of the relationship does not work (doing the same from the child side works fine). See test that is commented out below as well as the discussion at the end of emberjs#2881#issuecomment-204634262 This was previously emberjs#2881 and is related to emberjs#3698
This commit: 1. Allows one to rollback belongsTo and hasMany relationships. 2. Reintroduces dirtyRecordFor*Change hooks on the adapter that allow one to customize when a record becomes dirty. 3. Added 'removeDeletedFromRelationshipsPriorToSave' flag to Adapter that allows one to opt back into the old deleted record from many array behavior (pre emberjs#3539). Known issues: 1. Rolling back a hasMany relationship from the parent side of the relationship does not work (doing the same from the child side works fine). See test that is commented out below as well as the discussion at the end of emberjs#2881#issuecomment-204634262 This was previously emberjs#2881 and is related to emberjs#3698
This commit: 1. Allows one to rollback belongsTo and hasMany relationships. 2. Reintroduces dirtyRecordFor*Change hooks on the adapter that allow one to customize when a record becomes dirty. 3. Added 'removeDeletedFromRelationshipsPriorToSave' flag to Adapter that allows one to opt back into the old deleted record from many array behavior (pre emberjs#3539). Known issues: 1. Rolling back a hasMany relationship from the parent side of the relationship does not work (doing the same from the child side works fine). See test that is commented out below as well as the discussion at the end of emberjs#2881#issuecomment-204634262 This was previously emberjs#2881 and is related to emberjs#3698
This exactly describes my afternoon. Incredibly frustrating! |
@workmanw the short answer is that there have been many tried and failed attempts at resolving this by the core team. Discussions, spiked implementations, concepts. Ultimately it comes down to this being one of the hardest concepts to solve generally because there is simply so much variation in API design (even tying to This was one of the first things I looked to "fix" when I began working on The above said, over the past few years we've identified a few areas that if-improved would improve our ability to potentially, maybe, eventually rollback relationships.
There's also a few ideas that still have merits but don't solve the problem the way they first appear to:
And some ideas that just won't work due to API complexity
You'll maybe note that
Ultimately, the store is incapable of storing in-flight state for relationships. However, adapters are well suited for this, and if we improve usage patterns in the request layer and improve our ability to correctly respond to changes in canonical state we will unlock the ability for users to implement relationship rollback locally as well. Bear in mind, all of this discussion is only for the viewpoint that |
This commit: 1. Allows one to rollback belongsTo and hasMany relationships. 2. Reintroduces dirtyRecordFor*Change hooks on the adapter that allow one to customize when a record becomes dirty. 3. Added 'removeDeletedFromRelationshipsPriorToSave' flag to Adapter that allows one to opt back into the old deleted record from many array behavior (pre emberjs#3539). Known issues: 1. Rolling back a hasMany relationship from the parent side of the relationship does not work (doing the same from the child side works fine). See test that is commented out below as well as the discussion at the end of emberjs#2881#issuecomment-204634262 This was previously emberjs#2881 and is related to emberjs#3698
This commit: 1. Allows one to rollback belongsTo and hasMany relationships. 2. Reintroduces dirtyRecordFor*Change hooks on the adapter that allow one to customize when a record becomes dirty. 3. Added 'removeDeletedFromRelationshipsPriorToSave' flag to Adapter that allows one to opt back into the old deleted record from many array behavior (pre emberjs#3539). Known issues: 1. Rolling back a hasMany relationship from the parent side of the relationship does not work (doing the same from the child side works fine). See test that is commented out below as well as the discussion at the end of emberjs#2881#issuecomment-204634262 This was previously emberjs#2881 and is related to emberjs#3698
Closing this in favor of addons like ember-data-changetracker and use of a RecordData based approach. That said improved relationship primitives are in the works for RecordData authors to make use of, and would include tracked changes for easier rollback and diffing. |
This commit: 1. Allows one to rollback belongsTo and hasMany relationships. 2. Reintroduces dirtyRecordFor*Change hooks on the adapter that allow one to customize when a record becomes dirty. 3. Added 'removeDeletedFromRelationshipsPriorToSave' flag to Adapter that allows one to opt back into the old deleted record from many array behavior (pre emberjs#3539). Known issues: 1. Rolling back a hasMany relationship from the parent side of the relationship does not work (doing the same from the child side works fine). See test that is commented out below as well as the discussion at the end of emberjs#2881#issuecomment-204634262 This was previously emberjs#2881 and is related to emberjs#3698
This commit: 1. Allows one to rollback belongsTo and hasMany relationships. 2. Reintroduces dirtyRecordFor*Change hooks on the adapter that allow one to customize when a record becomes dirty. 3. Added 'removeDeletedFromRelationshipsPriorToSave' flag to Adapter that allows one to opt back into the old deleted record from many array behavior (pre emberjs#3539). 4. Adds bin/build.js to build a standalone version of ember-data. Known issues: 1. Rolling back a hasMany relationship from the parent side of the relationship does not work (doing the same from the child side works fine). See test that is commented out below as well as the discussion at the end of emberjs#2881#issuecomment-204634262 This was previously emberjs#2881 and is related to emberjs#3698
This commit: 1. Allows one to rollback belongsTo and hasMany relationships. 2. Reintroduces dirtyRecordFor*Change hooks on the adapter that allow one to customize when a record becomes dirty. 3. Added 'removeDeletedFromRelationshipsPriorToSave' flag to Adapter that allows one to opt back into the old deleted record from many array behavior (pre emberjs#3539). 4. Adds bin/build.js to build a standalone version of ember-data. Known issues: 1. Rolling back a hasMany relationship from the parent side of the relationship does not work (doing the same from the child side works fine). See test that is commented out below as well as the discussion at the end of emberjs#2881#issuecomment-204634262 This was previously emberjs#2881 and is related to emberjs#3698
This commit: 1. Allows one to rollback belongsTo and hasMany relationships. 2. Added 'shouldRemoveDeletedFromRelationshipsPriorToSave' flag to Adapter that allows one to opt back into the old deleted record from many array behavior (pre emberjs#3539). 3. Adds bin/build.js to build a standalone version of ember-data. Known issues: 1. Rolling back a hasMany relationship from the parent side of that relationship does not work (doing the same from the child side works fine). See test that is commented out below as well as the discussion at the end of emberjs#2881#issuecomment-204634262 This was previously emberjs#2881 and is related to emberjs#3698
This commit: 1. Allows one to rollback belongsTo and hasMany relationships. 2. Added 'shouldRemoveDeletedFromRelationshipsPriorToSave' flag to Adapter that allows one to opt back into the old deleted record from many array behavior (pre emberjs#3539). 3. Adds bin/build.js to build a standalone version of ember-data. Known issues: 1. Rolling back a hasMany relationship from the parent side of that relationship does not work (doing the same from the child side works fine). See test that is commented out below as well as the discussion at the end of emberjs#2881#issuecomment-204634262 This was previously emberjs#2881 and is related to emberjs#3698
This commit: 1. Allows one to rollback belongsTo and hasMany relationships. 2. Added 'shouldRemoveDeletedFromRelationshipsPriorToSave' flag to Adapter that allows one to opt back into the old deleted record from many array behavior (pre emberjs#3539). 3. Adds bin/build.js to build a standalone version of ember-data. Known issues: 1. Rolling back a hasMany relationship from the parent side of that relationship does not work (doing the same from the child side works fine). See test that is commented out below as well as the discussion at the end of emberjs#2881#issuecomment-204634262 This was previously emberjs#2881 and is related to emberjs#3698
This commit: 1. Allows one to rollback belongsTo and hasMany relationships. 2. Added 'shouldRemoveDeletedFromRelationshipsPriorToSave' flag to Adapter that allows one to opt back into the old deleted record from many array behavior (pre emberjs#3539). 3. Adds bin/build.js to build a standalone version of ember-data. Known issues: 1. Rolling back a hasMany relationship from the parent side of that relationship does not work (doing the same from the child side works fine). See test that is commented out below as well as the discussion at the end of emberjs#2881#issuecomment-204634262 This was previously emberjs#2881 and is related to emberjs#3698
This commit: 1. Allows one to rollback belongsTo and hasMany relationships. 2. Added 'shouldRemoveDeletedFromRelationshipsPriorToSave' flag to Adapter that allows one to opt back into the old deleted record from many array behavior (pre emberjs#3539). 3. Adds bin/build.js to build a standalone version of ember-data. Known issues: 1. Rolling back a hasMany relationship from the parent side of that relationship does not work (doing the same from the child side works fine). See test that is commented out below as well as the discussion at the end of emberjs#2881#issuecomment-204634262 This was previously emberjs#2881 and is related to emberjs#3698
Issues #3696, #3045