Skip to content

Commit eb4a2e4

Browse files
committed
refactor(system): simplify isValidLink
1 parent 97a2530 commit eb4a2e4

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/system.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -276,17 +276,10 @@ export function createReactiveSystem({
276276
}
277277

278278
function isValidLink(checkLink: Link, sub: ReactiveNode): boolean {
279-
const depsTail = sub.depsTail;
280-
if (depsTail !== undefined) {
281-
let link = sub.deps!;
282-
do {
283-
if (link === checkLink) {
284-
return true;
285-
}
286-
if (link === depsTail) {
287-
break;
288-
}
289-
} while ((link = link.nextDep!) !== undefined);
279+
for (let link = sub.depsTail; link !== undefined; link = link.prevDep) {
280+
if (link === checkLink) {
281+
return true;
282+
}
290283
}
291284
return false;
292285
}

0 commit comments

Comments
 (0)