reactive,
ComputedGetter,
WritableComputedOptions,
- ComputedRef
+ ComputedRef,
+ toRaw
} from '@vue/reactivity'
import {
ComponentObjectPropsOptions,
errorCaptured
} = options
- const renderContext =
+ const renderContext = toRaw(
instance.renderContext === EMPTY_OBJ &&
(computedOptions || methods || watchOptions || injectOptions)
? (instance.renderContext = reactive({}))
: instance.renderContext
+ )
const globalMixins = instance.appContext.mixins
// call it only during dev
: __DEV__
? () => {
warn(
- `Computed property "${key}" was assigned to but it has no setter.`
+ `Write operation failed: computed property "${key}" is readonly.`
)
}
: NOOP
if (renderContext[key] && !(key in proxyTarget)) {
Object.defineProperty(proxyTarget, key, {
enumerable: true,
- get: () => (renderContext[key] as ComputedRef).value
+ configurable: true,
+ get: () => (renderContext[key] as ComputedRef).value,
+ set: NOOP
})
}
}