adopted-ember-addons / ember-changeset

Ember.js flavored changesets, inspired by Ecto
http://bit.ly/ember-changeset-demo
MIT License
431 stars 141 forks source link

Stacklevel too deep during deepMerge (when calling changeset.unexecute()) #652

Open sly7-7 opened 2 years ago

sly7-7 commented 2 years ago

Version

ember-changeset@4.1.0

Test Case

I've created a test here: #653

Steps to reproduce

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

SergeAstapov commented 2 years ago

@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).

sly7-7 commented 2 years ago

@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 executeing changes to the model, this works fine during deep merge, but when unexecuteing, 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.