Skip to content

Commit

Permalink
refactor: streamline rollback logic in propagate function
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Jan 8, 2025
1 parent 11db8cb commit f11a24f
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions src/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,23 +181,19 @@ export function propagate(subs: Link): void {
}

if ((link = subs.nextSub!) === undefined) {
if (stack) {
let dep = subs.dep;
do {
--stack;
const depSubs = dep.subs!;
const prevLink = depSubs.prevSub!;
depSubs.prevSub = undefined;
link = prevLink.nextSub!;
if (link !== undefined) {
subs = link;
targetFlag = stack
? SubscriberFlags.ToCheckDirty
: SubscriberFlags.Dirty;
continue top;
}
dep = prevLink.dep;
} while (stack);
while (stack) {
--stack;
const dep = subs.dep;
const depSubs = dep.subs!;
subs = depSubs.prevSub!;
depSubs.prevSub = undefined;
if ((link = subs.nextSub!) !== undefined) {
subs = link;
targetFlag = stack
? SubscriberFlags.ToCheckDirty
: SubscriberFlags.Dirty;
continue top;
}
}
break;
}
Expand Down

0 comments on commit f11a24f

Please sign in to comment.