ember-inspector
ember-inspector copied to clipboard
Inspector modifies Changeset
Not 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
@basz this is due to the Proxy#set trap. Let's discuss over in e-c!
@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!
@snewcomer is this still an issue?
Still happens on ember-data 3.28.10 and ember-inspector 4.5.11
close dev tools, refresh page, open dev tools. changeset is pristine. click on Ember tab. changeset dirty

@snewcomer any ideas on how we could fix this?