-
-
Notifications
You must be signed in to change notification settings - Fork 141
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
ember-inspector silently pollutes changes
#589
Comments
A |
Great catch @betocantu93 I was going crazy to find the reason. 👍 |
I got around by using my own default changeset, and extend from it if I need further types //changesets/default
import { EmberChangeset } from 'ember-changeset';
const DENY_LIST = '_denyListKeys';
const AFTER_CHANGE = 'afterChange';
export class DefaultChangeset extends EmberChangeset {
[DENY_LIST] = ['_oldWillDestroy', 'willDestroy', '_super'];
_setProperty({ key, value, oldValue }) {
if (this[DENY_LIST].includes(key)) return;
super._setProperty({ key, value, oldValue });
//Adds an event for afterChange to hook as observer.
this.trigger(AFTER_CHANGE, key)
}
}
//helpers/changeset
import { helper } from '@ember/component/helper';
import { changeset as wrappedChangesetHelper } from 'ember-changeset/helpers/changeset';
import { DefaultChangeset } from '../changesets/default';
export function changeset(positional, options = {}) {
let opts = {
changeset: DefaultChangeset,
...options,
};
return wrappedChangesetHelper(positional, opts);
}
export default helper(changeset); Probably worth a PR, because curretnly we only have an allowList through changesetKeys which means you need to pass in all keys to avoid this bug, so I went for the denylist approach. Probably changesetKeys could be also be renamed to allowKeys. |
FWIW this is the same issue as #485 |
I am having this same issue, grateful if the denylist approach could be considered. |
deny list seems like a great idea if someone has the time to contribute! |
Changes are silently set to the changeset when ember-inspector is used (?) tracked it down to this line
https://github.com/emberjs/ember-inspector/blob/15f49e5ab04e738ec540550001ad8a1b1537eb70/ember_debug/object-inspector.js#L536
it triggers the proxy set and so
changeset.changes
is polluted.In particular these properties:
_oldWillDestroy
willDestroy
Maybe it would be great to have an inverse of
changesetKeys
, a denylist, which the default could be these propsThe text was updated successfully, but these errors were encountered: