refactor: move writable check out of computed setter (#112)
This commit is contained in:
parent
0bdee72e17
commit
caa9297da6
@ -28,7 +28,9 @@ export function computed<T>(
|
||||
? (getterOrOptions as (() => T))
|
||||
: (getterOrOptions as WritableComputedOptions<T>).get
|
||||
const setter = isReadonly
|
||||
? null
|
||||
? () => {
|
||||
// TODO warn attempting to mutate readonly computed value
|
||||
}
|
||||
: (getterOrOptions as WritableComputedOptions<T>).set
|
||||
|
||||
let dirty: boolean = true
|
||||
@ -57,12 +59,8 @@ export function computed<T>(
|
||||
trackChildRun(runner)
|
||||
return value
|
||||
},
|
||||
set value(newValue) {
|
||||
if (setter) {
|
||||
set value(newValue: T) {
|
||||
setter(newValue)
|
||||
} else {
|
||||
// TODO warn attempting to mutate readonly computed value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user