Skip to content

Commit 2ea55ef

Browse files
committed
perf: inline Pending flag unset for computed
1 parent 63c7919 commit 2ea55ef

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/index.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,16 +248,20 @@ function computedOper<T>(this: Computed<T>): T {
248248
const flags = this.flags;
249249
if (
250250
flags & 16 satisfies ReactiveFlags.Dirty
251-
|| (flags & 32 satisfies ReactiveFlags.Pending && checkDirty(this.deps!, this))
251+
|| (
252+
flags & 32 satisfies ReactiveFlags.Pending
253+
&& (
254+
checkDirty(this.deps!, this)
255+
|| (this.flags = flags & ~(32 satisfies ReactiveFlags.Pending), false)
256+
)
257+
)
252258
) {
253259
if (updateComputed(this)) {
254260
const subs = this.subs;
255261
if (subs !== undefined) {
256262
shallowPropagate(subs);
257263
}
258264
}
259-
} else if (flags & 32 satisfies ReactiveFlags.Pending) {
260-
this.flags = flags & ~(32 satisfies ReactiveFlags.Pending);
261265
}
262266
if (activeSub !== undefined) {
263267
link(this, activeSub);

0 commit comments

Comments
 (0)