question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ember-inspector silently pollutes `changes`

See original GitHub issue

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 props

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:5
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
betocantu93commented, Apr 24, 2021

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.

4reactions
snewcomercommented, Aug 18, 2021

deny list seems like a great idea if someone has the time to contribute!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - ember-inspector silently pollutes `changes` -
ember -inspector silently pollutes `changes` ... Changes are silently set to the changeset when ember-inspector is used (?) tracked it down to this...
Read more >
Object Inspector - Ember Guides
The Inspector includes a panel that allows you to view and interact with your Ember objects. To open it, click on any Ember...
Read more >
ember-data | Yarn - Package Manager
EmberData is a lightweight reactive data library for JavaScript applications that provides composable primitives for ordering query/mutation/peek flows, ...
Read more >
Air Compliance Inspection Manual - epa nepis
The inspector should keep abreast of changes in the field of air pollution, including current regulations, EPA and other agency policies, control technology ......
Read more >
Pierce Enforcer Cab Chassis Operator's Manual.pdf
REASONS FOR DAILY INSPECTION . ... THINGS TO LOOK FOR DURING INSPECTIONS . ... This will allow very little time for people and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found