Skip to content

Commit

Permalink
perf: remove canPropagate intermediate variable
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Dec 22, 2024
1 parent 5771ffb commit 78aa79f
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,16 @@ export function propagate(subs: Link): void {
const subFlags = sub.flags;

if (!(subFlags & SubscriberFlags.Tracking)) {
let canPropagate = !(subFlags >> 2);
if (!canPropagate) {
if (subFlags & SubscriberFlags.CanPropagate) {
sub.flags = (subFlags & ~SubscriberFlags.CanPropagate) | targetFlag;
canPropagate = true;
} else if (!(subFlags & targetFlag)) {
sub.flags = subFlags | targetFlag;
}
} else {
sub.flags = subFlags | targetFlag;
}
if (canPropagate) {
if (
(
!(subFlags >> 2)
&& (sub.flags = subFlags | targetFlag, true)
)
|| (
subFlags & SubscriberFlags.CanPropagate
&& (sub.flags = (subFlags & ~SubscriberFlags.CanPropagate) | targetFlag, true)
)
) {
const subSubs = (sub as Dependency).subs;
if (subSubs !== undefined) {
if (subSubs.nextSub !== undefined) {
Expand All @@ -170,6 +168,8 @@ export function propagate(subs: Link): void {
}
queuedEffectsTail = sub;
}
} else {
sub.flags = subFlags | targetFlag;
}
} else if (isValidLink(link, sub)) {
if (!(subFlags >> 2)) {
Expand Down

0 comments on commit 78aa79f

Please sign in to comment.