From 7e79f82fd0a3fe367bbbe04def139c9d73b3bf39 Mon Sep 17 00:00:00 2001 From: Johnson Chu Date: Thu, 26 Dec 2024 07:04:49 +0800 Subject: [PATCH] refactor: simplify conditionals in propagate function for better readability --- packages/reactivity/src/system.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/reactivity/src/system.ts b/packages/reactivity/src/system.ts index 426a622b4e6..fe91a088f0e 100644 --- a/packages/reactivity/src/system.ts +++ b/packages/reactivity/src/system.ts @@ -137,12 +137,14 @@ export function propagate(subs: Link): void { if (!(subFlags & SubscriberFlags.Tracking)) { if ( - (!(subFlags & (SubscriberFlags.ToCheckDirty | SubscriberFlags.Dirty)) && - ((sub.flags = subFlags | targetFlag), true)) || - (subFlags & SubscriberFlags.Recursed && - ((sub.flags = (subFlags & ~SubscriberFlags.Recursed) | targetFlag), - true)) + !( + subFlags & + (SubscriberFlags.Recursed | + SubscriberFlags.ToCheckDirty | + SubscriberFlags.Dirty) + ) ) { + sub.flags = (subFlags & ~SubscriberFlags.Recursed) | targetFlag const subSubs = (sub as Dependency).subs if (subSubs !== undefined) { if (subSubs.nextSub !== undefined) {