Skip to content

Commit 416cb7e

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

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/system.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -276,17 +276,12 @@ 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+
let link = sub.depsTail;
280+
while (link !== undefined) {
281+
if (link === checkLink) {
282+
return true;
283+
}
284+
link = link.prevDep;
290285
}
291286
return false;
292287
}

0 commit comments

Comments
 (0)