File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 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> {
1616 readonly effect : ReactiveEffect < T >
1717}
1818
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
2121
2222export interface WritableComputedOptions < T > {
2323 get : ComputedGetter < T >
@@ -41,9 +41,10 @@ export class ComputedRefImpl<T> {
4141 isReadonly : boolean ,
4242 isSSR : boolean
4343 ) {
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+ )
4748 this . effect . computed = this
4849 this . effect . active = this . _cacheable = ! isSSR
4950 this [ ReactiveFlags . IS_READONLY ] = isReadonly
You can’t perform that action at this time.
0 commit comments