Skip to content

Commit abf3265

Browse files
committed
perf(signals): laneSeams reads the lane through l?._lane (#4349)
The seam's three `l != null && l._lane` tests become `l?._lane`, and the held-reader skip shares the lane test: the #4349 fix now costs −1 B minified on every lane-engine scenario instead of +20 B. Changeset covers the affects() mark lifetime. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015hPxMkC3jg3Uivh65gvaf2
1 parent f136e94 commit abf3265

2 files changed

Lines changed: 13 additions & 9 deletions

File tree

‎.changeset/action-refresh-ispending-loop.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,8 @@ reader a parked transaction holds that read none of its stagings now runs at
1212
the landing instead. The same loop hit `[isPending(x), x()]` in one render
1313
effect after an action's write to `x`'s input. A bare refresh stays quiet
1414
(`v41`, then `v42`); `affects()` + `refresh()` shows `pending`, then `v42`.
15+
An action's `affects()` mark on a node whose own refetch is still in flight
16+
when the action's transaction lands now stays until that refetch lands, as a
17+
mark declared outside an action already did: an action that ends right after
18+
`affects(x); refresh(x)` shows `pending` whether the `isPending` read is inline
19+
or in its own memo, as JSX compiles a condition.

‎packages/signals/src/core/lanes.ts‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -854,13 +854,12 @@ const laneSeams = (leaks: Computed<any>[] | null): void => {
854854
// landing (#4349).
855855
if (
856856
r._flags & REACTIVE_DISPOSED ||
857-
(l != null &&
858-
(l._lane
859-
? l._parent?._verdict === l &&
860-
(r._config & CONFIG_VERDICT
861-
? !(r._flags & REACTIVE_PROBE_UNANSWERED)
862-
: !blocked(l._parent))
863-
: !(r._flags & (REACTIVE_STAGED_READ | REACTIVE_PROBE_UNANSWERED))))
857+
(l?._lane
858+
? l._parent?._verdict === l &&
859+
(r._config & CONFIG_VERDICT
860+
? !(r._flags & REACTIVE_PROBE_UNANSWERED)
861+
: !blocked(l._parent))
862+
: l && !(r._flags & (REACTIVE_STAGED_READ | REACTIVE_PROBE_UNANSWERED)))
864863
)
865864
continue;
866865
// A leaked effect re-derives seated in its lane from its first read: it
@@ -869,9 +868,9 @@ const laneSeams = (leaks: Computed<any>[] | null): void => {
869868
// the staging, then re-enters the lane at its guess read and leaks
870869
// again — every round (#4014). A computed is already seated by its
871870
// override, and a written guess's own pass stays the frame's.
872-
if (l != null && l._lane && (r as any)._type) r._flags |= REACTIVE_LANE_DIRTY;
871+
if (l?._lane && (r as any)._type) r._flags |= REACTIVE_LANE_DIRTY;
873872
enqueueSub(r);
874-
if (l != null && l._lane && leaked.indexOf(l) === -1) leaked.push(l);
873+
if (l?._lane && leaked.indexOf(l) === -1) leaked.push(l);
875874
}
876875
for (let k = Math.min(judged, lanes.length) - 1; k >= 0; k--)
877876
laneSeam(lanes[k], leaked.indexOf(lanes[k]) !== -1);

0 commit comments

Comments
 (0)