Skip to content

Commit 94f4078

Browse files
committed
fix(signals): latestOpened clears only at flush end, not on a real join
Clearing the `latest()`-only record in `joinFuture` let a memo of `latest()` end on a stuck `[ROOT-E]` where the inline read shows content (async-gen 91501 #1158, E9). The two forms must show the same screen (F-6), so the record now clears only when the flush ends; a verdict reader's plain read of a staging in that transaction stays the frame's read (D-22), not lane work (D-37) and not a pass with no value yet (D-6). Pins #1158's E9 form in packages/web/test/async-gen/e9-91501-1158.spec.ts (fails on 9efb987). Ledger lines and the live-server floor follow the -8 B minified. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015hPxMkC3jg3Uivh65gvaf2
1 parent 9efb987 commit 94f4078

4 files changed

Lines changed: 33 additions & 10 deletions

File tree

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,6 @@ export function resolveTx(t: Transaction): Transaction {
371371
* went pending with nothing held). Joining a second one merges it into the
372372
* flush's: the work that touched both entangles them (A15). */
373373
export function joinFuture(t: Transaction | null): void {
374-
// Something real joins: the transaction is no longer `latest()`'s alone.
375-
latestOpened = null;
376374
const f = flushTransaction;
377375
if (f === null) {
378376
flushTransaction = t === null ? newTransaction(false) : resolveTx(t);
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* @vitest-environment jsdom
3+
*/
4+
// async-gen seed 91501 #1158 (E9, F-6): `latest(x)` read at the leaf and the
5+
// same read through a memo show the same screens, and the memo form is not
6+
// left on a stuck `[ROOT-E]` (liveness). The flush's record of a transaction
7+
// only `latest()` reads opened clears when the flush ends, not on a later
8+
// join within it: clearing it there split the passes of one flush between
9+
// the frame's read and the screen, and the memo form stuck on `[ROOT-E]`.
10+
// [s0=0 s1=2 m0=async(latest(s0) !%4=3) m1=memo(m0 !%4=2) m2=memo(latest(m0)+s1)]
11+
// <Show when=latest(m0)>…<span fx[s0(),m0()]>latest(m1) latest(s0)</span></Show>
12+
// :: t s1=0 S1 f t f f S2 f s0=3
13+
import { expect, test } from "vitest";
14+
import fc from "fast-check";
15+
import { runScenario } from "./run.js";
16+
import { scenarioArb } from "./scenario.js";
17+
18+
test("91501 #1158: the leaf and the memo form of latest() show the same screens", async () => {
19+
const sc = fc.sample(scenarioArb(), { seed: 91501, numRuns: 1159 })[1158];
20+
const leaf = await runScenario(sc, {});
21+
const memo = await runScenario(sc, { latestDerive: true });
22+
expect(memo.screens).toEqual(leaf.screens);
23+
expect(memo.final).toBe(leaf.final);
24+
expect(memo.final).not.toContain("[ROOT-E]");
25+
});

‎scripts/size/floor-caps.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"page: live server components (base + live/GET + action + isPending/latest)": {
1919
"cap": "37.75 KB",
20-
"minified": 115709
20+
"minified": 115701
2121
},
2222
"server: floor (getRequestEvent + isServer)": {
2323
"cap": "1.34 KB",

0 commit comments

Comments
 (0)