File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -36,21 +36,25 @@ export class ComputedRefImpl<T> {
36
36
public _computedsToAskDirty : ComputedRefImpl < any > [ ] = [ ]
37
37
public _cacheable : boolean
38
38
39
+ private _triggeredAfterLastEffect = false
40
+
39
41
constructor (
40
42
getter : ComputedGetter < T > ,
41
43
private readonly _setter : ComputedSetter < T > ,
42
44
isReadonly : boolean ,
43
45
isSSR : boolean
44
46
) {
45
- this . effect = new ReactiveEffect ( getter , ( _c ) => {
47
+ this . effect = new ReactiveEffect ( getter , _c => {
46
48
if ( ! this . _dirty ) {
47
49
if ( _c ) {
48
50
this . _computedsToAskDirty . push ( _c )
49
- }
50
- else {
51
+ } else {
51
52
this . _dirty = true
52
53
}
53
- triggerRefValue ( this , this )
54
+ if ( ! this . _triggeredAfterLastEffect ) {
55
+ this . _triggeredAfterLastEffect = true
56
+ triggerRefValue ( this , this )
57
+ }
54
58
}
55
59
} )
56
60
this . effect . computed = this
@@ -77,6 +81,7 @@ export class ComputedRefImpl<T> {
77
81
}
78
82
self . _value = newValue
79
83
self . _dirty = false
84
+ self . _triggeredAfterLastEffect = false
80
85
}
81
86
self . _computedsToAskDirty . length = 0
82
87
return self . _value
You can’t perform that action at this time.
0 commit comments