Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const vmBeingRendered = getVMBeingRendered();
assert.invariant(
!isInvokingRender,
`${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString(
key
)}`
);
assert.invariant(
!isUpdatingTemplate,
`Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString(
key
)}`
);
}
if (set) {
if (features.ENABLE_REACTIVE_SETTER) {
let ro = vm.oar[key as any] as AccessorReactiveObserver;
if (isUndefined(ro)) {
ro = vm.oar[key as any] = new AccessorReactiveObserver(vm, set);
}
// every time we invoke this setter from outside (through this wrapper setter)
// we should reset the value and then debounce just in case there is a pending
// invocation the next tick that is not longer relevant since the value is changing
// from outside.
ro.reset(newValue);
ro.observe(() => {
set.call(this, newValue);
});
} else {
set.call(this, newValue);
}
} else if (process.env.NODE_ENV !== 'production') {