Skip to content

Commit 8ba9f78

Browse files
committed
1 parent d8866f0 commit 8ba9f78

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

‎packages/web/test/recreated-reader-held-boundary-4378.spec.tsx‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import { describe, expect, test } from "vitest";
1010
import { createMemo, createSignal, Errored, flush, latest, Loading, Show } from "solid-js";
1111
import { render } from "../src/index.js";
12+
import { runScenario } from "./async-gen/run.js";
13+
import type { Scenario } from "./async-gen/scenario.js";
1214

1315
const tick = async () => {
1416
for (let i = 0; i < 5; i++) await Promise.resolve();
@@ -61,3 +63,45 @@ describe("a reader born in the flush that clears an upstream error (#4378)", ()
6163
dispose();
6264
});
6365
});
66+
67+
// The generator's E8 case at next @ 40cde2cd: the staging the hold built is
68+
// superseded at every frame node up the chain (the inner Errored, the root
69+
// Loading and Errored), each re-run from the heap outside its hold and back
70+
// to its committed fallback.
71+
test("the generator's E8 case: recreated readers under nested boundaries (#4378)", async () => {
72+
const sc: Scenario = {
73+
signals: [2, 3],
74+
memos: [
75+
{ async: false, deps: [{ src: { k: "s", i: 1 }, how: "latest" }], poison: 0 },
76+
{ async: true, deps: [{ src: { k: "m", i: 0 }, how: "plain" }], poison: 0 }
77+
],
78+
tree: {
79+
t: "errored",
80+
child: {
81+
t: "leaf",
82+
text: [],
83+
attrs: [
84+
{ how: "plain", src: { k: "s", i: 1 } },
85+
{ how: "plain", src: { k: "m", i: 1 } }
86+
],
87+
grouped: false
88+
}
89+
},
90+
steps: [
91+
{ t: "settle", pick: 0 },
92+
{ t: "task" },
93+
{ t: "action", s: 1, v: 0 },
94+
{ t: "write", s: 1, v: 1 },
95+
{ t: "flush" },
96+
{ t: "action", s: 1, v: 0 },
97+
{ t: "write", s: 1, v: 2 },
98+
{ t: "settle", pick: 3 }
99+
]
100+
} as Scenario;
101+
const kept = await runScenario(sc);
102+
const recreated = await runScenario(sc, { remount: true });
103+
// Where nothing is in flight (the last step settles the last request).
104+
expect(recreated.screens.at(-1)).toBe("[E]");
105+
expect(recreated.final).toBe(kept.final);
106+
expect(recreated.final).toBe("[E]");
107+
});

0 commit comments

Comments
 (0)