[2.0 / next] A rejection under an armed <Loading on> reveals a stale value and commits a write held outside it
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 18/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, typescript
- Ambito
- frontend
Direzione di ricerca
Start with the reproduction spec in packages/web/test/, which uses render, createMemo, and <Loading on={...}> inside <Errored>, and run it with npx vitest run. The fifth frame is the one to explain: it shows a0 beside s1=2 while the write is held. Trace how Loading and Errored decide which frame to show when a memo rejects during a held transition. Done means the spec passes and the expected frames hold, which probably requires a maintainer decision on the intended semantics first.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
a0 and a1 both ask by s1. a1 is read outside a <Loading on={s0()}>, and a0 and s1 are read inside it. A handler writes s0 and s1 together, so the boundary re-arms and the s1 write is held on a1, which is read outside.
When a0's new question rejects while a1's is still out, the boundary drops its fallback and shows a0=10, the answer for s1 = 0, beside s1=2. Next to it, a1 still shows 11, its answer for s1 = 1. So one frame shows three different values of s1. The frame becomes error only when a1:2 lands.
Found by checking every frame of generated ryansolid/reactivescript programs, compiled onto Solid, against F-1.
Your Example Website or App
The vitest spec below (in packages/web/test/), on next @ 77be406ca.
Steps to Reproduce the Bug or Issue
import { render } from "@solidjs/web";
import { createMemo, createSignal, Errored, flush, Loading } from "solid-js";
import { expect, it } from "vitest";
const tick = async () => { for (let i = 0; i < 2; i++) { await new Promise(r => setTimeout(r, 0)); flush(); } };
it("a rejection under an armed <Loading on> does not reveal a stale value or commit a held write", async () => {
const flights = new Map<string, { resolve: (v: number) => void; reject: (e: Error) => void }>();
const ask = (key: string) => new Promise<number>((resolve, reject) => flights.set(key, { resolve, reject }));
const [s0, setS0] = createSignal(0);
const [s1, setS1] = createSignal(0);
const el = document.createElement("div");
const frames: string[] = [];
const dispose = render(() => {
const a0 = createMemo(() => ask("a0:" + s1()));
const a1 = createMemo(() => ask("a1:" + s1()));
return (
<Errored fallback={<p>error</p>}>
<p>[a1={a1()}]</p>
<Loading on={s0()} fallback={<p>loading</p>}>
<p>[a0={a0()}]</p>
<p>[s1={s1()}]</p>
</Loading>
</Errored>
);
}, el);
await tick();
flights.get("a1:0")!.resolve(9); flights.get("a0:0")!.resolve(10); await tick(); frames.push(el.textContent!);
setS0(1); setS1(1); flush(); await tick(); frames.push(el.textContent!);
flights.get("a1:1")!.resolve(11); await tick(); frames.push(el.textContent!);
setS0(2); setS1(2); flush(); await tick(); frames.push(el.textContent!);
flights.get("a0:2")!.reject(new Error("boom")); await tick(); frames.push(el.textContent!);
flights.get("a1:2")!.resolve(12); await tick(); frames.push(el.textContent!);
dispose();
expect(frames).toEqual([
"[a1=9][a0=10][s1=0]",
"[a1=9][a0=10][s1=0]",
"[a1=11]loading",
"[a1=11]loading",
"[a1=11]loading", // received "[a1=11][a0=10][s1=2]"
"error",
]);
});
npx vitest run in packages/web. The fifth frame is [a1=11][a0=10][s1=2]. The same happens when the outside reader is wrapped in <Show when={s1() > 0}>.
Expected behavior
While the s1 = 2 write is held, the boundary keeps its fallback and s1 is not committed (F-2, F-5). The rejection is an answer for s1 = 2, and it shows when a value for that question would (F-12, D-41). In no frame does a0 show its answer for s1 = 0 beside s1=2.
Platform
- OS: macOS
- Browser: n/a (jsdom)
- Version: solid-js 2.0.0-rc.20,
next@ 77be406ca
- Lingua principale
- TypeScript
- Stelle
- 36.2k
- Fork
- 1.1k
- Merge medio
- 10h 10m
- PR unite (30g)
- 505
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di solidjs/solid
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 22/100
I maintainer di solito rispondono entro 1 giorno
-
What gets passed to the `when` prop of a `Show` still gets executed twice on SSRForse già presa @brenelz l’ha presa 4 giorni fa. Aperta1.x
Difficoltà 3/5 1-2 giorni Idoneità per principianti 52/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
solidjs/solid#4447 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di solidjs/solid
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
riverqueue/river#1576 ·
I maintainer di solito rispondono entro 1 giorno
-
[bug] A prompt queued during a run is assessed without its textForse già presa @jwiegley l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
DevMortimer/pi-warden#211 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
mattermost/compass-design#191 ·
I maintainer di solito rispondono entro 1 giorno
-
Add unit tests for the organization admin role checkForse già presa @SaffuSafwan l’ha presa oggi. Apertaarea/core good first issue help wanted
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
elmohq/elmo#1095 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
HorusGoul/trizum#559 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno