File tree 1 file changed +6
-5
lines changed
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -16,8 +16,8 @@ export interface WritableComputedRef<T> extends Ref<T> {
16
16
readonly effect : ReactiveEffect < T >
17
17
}
18
18
19
- export type ComputedGetter < T > = ( ... args : any [ ] ) => T
20
- export type ComputedSetter < T > = ( v : T ) => void
19
+ export type ComputedGetter < T > = ( oldValue ?: T ) => T
20
+ export type ComputedSetter < T > = ( newValue : T ) => void
21
21
22
22
export interface WritableComputedOptions < T > {
23
23
get : ComputedGetter < T >
@@ -41,9 +41,10 @@ export class ComputedRefImpl<T> {
41
41
isReadonly : boolean ,
42
42
isSSR : boolean
43
43
) {
44
- this . effect = new ReactiveEffect ( getter , ( ) => {
45
- triggerRefValue ( this , DirtyLevels . ComputedValueMaybeDirty )
46
- } )
44
+ this . effect = new ReactiveEffect (
45
+ ( ) => getter ( this . _value ) ,
46
+ ( ) => triggerRefValue ( this , DirtyLevels . ComputedValueMaybeDirty )
47
+ )
47
48
this . effect . computed = this
48
49
this . effect . active = this . _cacheable = ! isSSR
49
50
this [ ReactiveFlags . IS_READONLY ] = isReadonly
You can’t perform that action at this time.
0 commit comments