Skip to content

Commit 399f155

Browse files
johnsoncodehkyyx990803
authored andcommitted
perf: reduce triggerRefValue() triggered
1 parent fbf214a commit 399f155

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

packages/reactivity/src/computed.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,13 @@ export class ComputedRefImpl<T> {
4343
isSSR: boolean
4444
) {
4545
this.effect = new ReactiveEffect(getter, (_c) => {
46-
if (_c) {
47-
this._computedsToAskDirty.push(_c)
48-
triggerRefValue(this, this)
49-
}
50-
else if (!this._dirty) {
51-
this._dirty = true
46+
if (!this._dirty) {
47+
if (_c) {
48+
this._computedsToAskDirty.push(_c)
49+
}
50+
else {
51+
this._dirty = true
52+
}
5253
triggerRefValue(this, this)
5354
}
5455
})

0 commit comments

Comments
 (0)