ember-changeset
ember-changeset copied to clipboard
Stacklevel too deep during deepMerge (when calling changeset.unexecute())
Version
Test Case
I've created a test here: #653
Steps to reproduce
- Create a changeset from an ember-data model with sync belongsTo
- Change this belongsTo
- call changeset.execute()
- call changeset.unexecute() => exception
Expected Behavior
I was expecting the changeset to have the previous belongsTo model associated.
Actual Behavior
It seems like ember-changeset should work well with Ember-Data, but I think I do somehting wrong, because it crashes during unexecute
, when it encounters a belongsTo relation.
Error: Unable to 'mergeDeep' with your data. Are you trying to merge two ember-data objects? Please file an issue with ember-changeset.
at Proxy.mergeDeep (merge-deep.js:161:1)
at Proxy.unexecute (validated-changeset.es5.js:409:155)
but I don't do any merge by myself
@sly7-7 FYI there is related PR #645 which fixes working with Ember Data (there are at least several ways of doing so, that PR suggest one way of doing it).
@SergeAstapov Hi, thank you for taking time to answer. Unless I'm missing something, my use case is different, as I don't use snapshot/restore, but execute/unexecute. That said, I've tried to run against the PR branch you mentioned, and I have the same "buggy" behavior. When execute
ing changes to the model, this works fine during deep merge, but when unexecute
ing, it tries to deepmerge two ember-data models (even cloning the underlying backburner instance).
So I think there is something wrong when the changeset is "saving" the oldContent during execute
, which makes unexecute
behaves badly.