These tests are a starting point to discuss a strange behavior I only see with Changesets and Modifiers.
My best understanding is that the interaction between changesets and modifiers causes them to recalculate even when unrelated properties of the changeset are modified.
This might seem expected at first till you realize that this behavior does not happen with helpers and also with non-changeset objects.
This PR had to add ember-modifier and ember-functions-as-modifiers-polyfill addons to show the expected use case for these two modifier addons.
The simplest code example I have is this:
import { modifier } from 'ember-modifier';
export default modifier(function countModifierUpdates() {
// NOTE there is no consuming any tracked properties here
console.count('count-modifier-updates updated');
});
{{#with (changeset
(hash foo="foo will not change" bar="bar will change")
) as |changesetObj|}}
{{! NOTE changesetObj.foo never changes }}
<div {{count-modifier-updates changesetObj.foo}}></div>
<button id="submit-btn" {{on "click"
(fn (changeset-set changesetObj "bar") "bar has changed")
}}>Click</button>
{{/with}}
These tests are a starting point to discuss a strange behavior I only see with Changesets and Modifiers.
My best understanding is that the interaction between changesets and modifiers causes them to recalculate even when unrelated properties of the changeset are modified.
This might seem expected at first till you realize that this behavior does not happen with helpers and also with non-changeset objects.
This PR had to add
ember-modifier
andember-functions-as-modifiers-polyfill
addons to show the expected use case for these two modifier addons.The simplest code example I have is this: