3👍
How about using oldVal to determine whether the watcher is in the first specific initialization or not. Maybe it will look like this…
'foo.aaa': function (newVal, oldVal) {
if(oldVal) {
// not in first specific initialization
this.foo.bbb = null;
this.callRest();
} else {
// in first specific initialization
}
},
Hopefully, I don’t misunderstood your question.
0👍
It sounds like you should manage the state of how the object is being manipulated. For example, create a boolean data value named something like editedFromMixin
, which defaults to false
.
When changing values from the created
method of your mixin, update editedFromMixin
to true
.
Then, in your watchers, check if editedFromMixin
is false before setting foo.bbb
to null
. And finally, also in your mixin, end by flipping editedFromMixin
back to the default false
.
The effect is changes from the mixin will set the flag that prevents your watchers from making the undesired changes – but only once per iteration of updates.