Skip to content
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

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

Open
sly7-7 opened this issue Jul 8, 2022 · 2 comments
Open

Comments

@sly7-7
Copy link

sly7-7 commented Jul 8, 2022

Version

[email protected]

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

@SergeAstapov
Copy link
Contributor

@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
Copy link
Author

sly7-7 commented Jul 11, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants