Skip to content

Commit 3f8be1d

Browse files
committed
refactor(signals): shorter heal-check walk (#4644)
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0117BoWNSSgtemsSYsaX2hXE
1 parent 919967e commit 3f8be1d

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

‎packages/signals/src/boundaries.ts‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -373,11 +373,10 @@ function caughtBelow(b: Boundary, r: Computed<any>, s: Computed<any>): boolean {
373373
* hoisted memo, a derived store's derive, a loading boundary's output). Each
374374
* upstream node is walked once (`seen`), so a shared upstream graph costs its
375375
* size, not its paths. */
376-
function reads(n: Computed<any>, s: Computed<any>, seen = new Set<any>()): boolean {
377-
for (let l = n._deps, d; l; l = l._nextDep)
378-
if ((d = l._dep) === s || (seen.size < seen.add(d).size && reads(d as Computed<any>, s, seen)))
379-
return true;
380-
return false;
376+
function reads(n: Computed<any>, s: Computed<any>, seen?: Set<any>): any {
377+
for (let l = n._deps, h; l; l = l._nextDep)
378+
if ((h = l._dep) === s || ((seen ||= new Set()).size < seen.add(h).size && reads(h, s, seen)))
379+
return 1;
381380
}
382381

383382
/** Drop the readers that settled or died. Settled: a loading reader no

0 commit comments

Comments
 (0)