Inspector modifies Changeset
See original GitHub issueNot sure if this really is a bug or an unwanted side effect…
When I create a changeset from an ember-data model and open the ember-inspector tab, two properties are created in the changes attribute of the changeset. That means the changeset state (pristine) is changed just by inspecting the ember application… This continues to be true (even after reloading) until I *close( the console window (simply opening a different tab then the ember-inspector will not help)
I suspect this is because ember-data inspects the models and adds some private utility methods and that doesn’t play well with the changeset idea…
To Reproduce Create an changeset from an e-d model.
model() {
return this.store.findRecord('model', id).then(model => new Changeset(model));
}
Add something like this to the template
<pre class="small">
{{if this.model.isPristine "pristine" "dirty"}}
{{json this.model.changes}}
</pre>
Expected behavior The rendered output should be:
pristine []
But as soon as you open the ember-inspector it becomes;
dirty [
{
"key": "_oldWillDestroy",
"value": "function superWrapper() {\n var orig = this._super;\n this._super = superFunc;\n var ret = func.apply(this, arguments);\n this._super = orig;\n return ret;\n }"
},
{
"key": "willDestroy",
"value": "function superWrapper() {\n var orig = this._super;\n this._super = superFunc;\n var ret = func.apply(this, arguments);\n this._super = orig;\n return ret;\n }"
}
]
Environment ember-inspector: 4.1.0 ember: 3.16.8 ember-data: 3.16.6 ember-changeset: 3.4.0,
Chrome
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:6 (2 by maintainers)
Top GitHub Comments
@snewcomer I am having this same issue, unfortunately. If you could kindly point me to the resolution (potentially linked in discord?), I would be greatly appreciative!
I am using v4.4.1 of the inspector, and am using the latest stable ember-changeset on an Ember 3.27 app. Thanks!
I’ve also got a very similar issue on 3.26.1, took a long time to debug it!