@snewcomer This is another approach for #586, property notifications
We use tracked-built-ins to have a common tracked object reference that we can keep notifying of changes by lazily consuming tags on every changeset.get.
This PR also implements addObserver and removeObserver to allow client code to add / remove observers in an ergonomic way to a changeset.
The only "downside" AFAIK is that for classic computeds, we have to manually subscribe to the changeset.mirror property. One way to solve this, is to just use native getters or, create a native getter which consumes the value and then add that native getter to the dependencies of your computed, i.e.
get myProp() {
return this.args.changeset.get(this.args.path);
}
@computed('myProp')
get someComputed() {
return ....
}
//or
@computed(`args.changeset.mirror.yourpath`)
...
@snewcomer This is another approach for #586, property notifications
We use tracked-built-ins to have a common tracked object reference that we can keep notifying of changes by lazily consuming tags on every changeset.get.
This PR also implements
addObserver
andremoveObserver
to allow client code to add / remove observers in an ergonomic way to a changeset.The only "downside" AFAIK is that for classic computeds, we have to manually subscribe to the
changeset.mirror
property. One way to solve this, is to just use native getters or, create a native getter which consumes the value and then add that native getter to the dependencies of your computed, i.e.Here's the sandbox im using for this DEMO: https://github.com/betocantu93/changeset-tests/tree/try-mirror
Notice: please use try-mirror branch