feat(computed): warn if trying to set a readonly computed (#161)
This commit is contained in:
committed by
Evan You
parent
7963c01a67
commit
530be302fc
@@ -29,7 +29,9 @@ export function computed<T>(
|
||||
: (getterOrOptions as WritableComputedOptions<T>).get
|
||||
const setter = isReadonly
|
||||
? () => {
|
||||
// TODO warn attempting to mutate readonly computed value
|
||||
if (__DEV__) {
|
||||
console.warn('Write operation failed: computed value is readonly')
|
||||
}
|
||||
}
|
||||
: (getterOrOptions as WritableComputedOptions<T>).set
|
||||
|
||||
|
||||
Reference in New Issue
Block a user