Skip to content

Commit 94fe5b4

Browse files
ryansolidClaude via Cursorcursoragent
committed
refactor(signals): drop dead isPending refresh from lane pending/settle
laneAsyncPending and laneAsyncSettled refreshed the lane source's isPending companion every time a derived node went pending or settled under the lane. computePendingState never reads _pendingAsync, so the refresh recomputed the same verdict from the same inputs; the source's own write (syncCompanions), commit (commitPendingNode -> snapCompanions) and settlement-checkpoint paths already keep the companion current. isPending/latest scenario: 10.080 -> 10.062 KB; cap 10.13 -> 10.10. Co-authored-by: Claude via Cursor <[email protected]> Co-authored-by: Cursor <[email protected]>
1 parent 23477ae commit 94fe5b4

3 files changed

Lines changed: 16 additions & 5 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@solidjs/signals": patch
3+
---
4+
5+
Drop the lane source's redundant `isPending` companion refresh on derived pending/settle; the verdict never depended on it and the source's own paths keep it current.

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -333,14 +333,16 @@ function recomputeLane(el: Computed<any>, own: boolean): OptimisticLane | null |
333333
return null;
334334
}
335335

336-
/** recompute()'s catch path: track pending async in the current lane. */
336+
/** recompute()'s catch path: record the pending async as the current lane's
337+
* (ownership — laneHeld decides the hold). The lane source's isPending
338+
* companion is NOT refreshed here: its verdict never read _pendingAsync, and
339+
* the source's own write/commit/settlement paths keep it current. */
337340
function laneAsyncPending(el: Computed<any>): void {
338341
const lane = findLane(currentOptimisticLane!);
339342
if (lane._source !== el) {
340343
lane._pendingAsync.add(el);
341344
ext(el)._optimisticLane = lane;
342345
(el as any)._config |= CONFIG_HAS_LANE;
343-
GlobalQueue._updatePendingSignal !== null && GlobalQueue._updatePendingSignal(lane._source);
344346
}
345347
}
346348

@@ -349,8 +351,6 @@ function laneAsyncSettled(el: Computed<any>): void {
349351
const resolvedLane = resolveLane(el);
350352
if (resolvedLane) {
351353
resolvedLane._pendingAsync.delete(el);
352-
GlobalQueue._updatePendingSignal !== null &&
353-
GlobalQueue._updatePendingSignal(resolvedLane._source);
354354
}
355355
}
356356

‎scripts/size/.size-limit.js‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,13 @@ module.exports = [
359359
// same INV-3 rule transactions use — lives in the lanes module this
360360
// scenario retains via latest(); the core floor and createStore are
361361
// byte-identical. ~40 B for the predicate and its two call sites.
362-
limit: "10.13 KB",
362+
//
363+
// Dead companion refresh removed (follow-up): 10.13 -> 10.10 KB,
364+
// measured at 10.062 macOS. laneAsyncPending/laneAsyncSettled refreshed
365+
// the lane source's isPending companion on every derived pending/settle,
366+
// but computePendingState never read _pendingAsync — the source's own
367+
// write, commit and settlement paths already refresh it. -18 B.
368+
limit: "10.10 KB",
363369
modifyEsbuildConfig
364370
},
365371
{

0 commit comments

Comments
 (0)