[2.0.3 / main] Non-keyed <Show> halts with "Stale read from <Show>." when the update that closes it waits on an async read
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 18/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- javascript, node.js
- Área
- frontend
Línea de trabajo
The bug sits in the reactive core: the non-keyed Show path and the sync memo that reads the accessor during a held update, so start with the Show implementation and the signals scheduler. Run the reproduction script with node --conditions=browser show-stale-string.mjs; it currently halts with [REACTIVITY_HALTED] before its last line. Done means the script prints all three view and read entries, matching the keyed output, without halting.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
A non-keyed <Show> with a function child halts the page when the update that makes when falsy also waits on an asynchronous read elsewhere. A memo inside the child runs again before the Show removes the child, its read of the accessor throws "Stale read from .", and Solid logs [REACTIVITY_HALTED]. Nothing updates after that.
In the script below, when and the child both read ahead with latest, and a memo beside them waits on a promise once the status changes. It stops before it prints its last line:
[REACTIVITY_HALTED] Stale read from <Show>.
With keyed: true and the child reading value instead of value(), the same script prints every update:
{"views":["shown","hidden","shown"],"reads":["failed/modelFailed","failed/second","failed/third"]}
There is a second form. With when written as the compiler emits status === "failed" ? failure : undefined, with its nested memo, the accessor returns undefined to the child's memo instead of throwing, although its type is Accessor<NonNullable<T>>. I can post that script too.
Found at: solid-js 2.0.3 with @solidjs/signals 2.0.3, and main at da28cd5. Also on 2.0.0.
Your Example Website or App
The script under "Steps to Reproduce"
Steps to Reproduce the Bug or Issue
Save as show-stale-string.mjs in a folder with solid-js installed and run node --conditions=browser show-stale-string.mjs.
// node --conditions=browser show-stale-string.mjs
import { Show, createMemo, createRenderEffect, createRoot, createSignal, flush, latest } from "solid-js";
const [data, setData] = createSignal({ status: "failed", reason: "modelFailed" });
const gate = Promise.withResolvers();
const views = [];
const reads = [];
createRoot(() => {
const job = createMemo(() => data());
const view = Show({
get when() {
return latest(data).reason;
},
children(value) {
const read = createMemo(() => `${latest(data).status}/${value()}`, { sync: true });
createRenderEffect(read, (text) => {
reads.push(text);
});
return "shown";
},
});
createRenderEffect(
() => view(),
(shown) => {
views.push(shown ?? "hidden");
},
);
const slow = createMemo(() => (job().status === "failed" ? 0 : gate.promise));
createRenderEffect(slow, () => {});
});
flush();
setData({ status: "queued" });
flush();
gate.resolve(1);
await new Promise((resolve) => setImmediate(resolve));
flush();
setData({ status: "failed", reason: "second" });
flush();
setData({ status: "failed", reason: "third" });
flush();
await new Promise((resolve) => setImmediate(resolve));
flush();
console.log(JSON.stringify({ views, reads }));
Expected behavior
The update completes: the Show removes the child, and the later updates show it again, as they do with keyed.
Screenshots or Videos
No response
Platform
- OS: Linux
- Runtime: Node.js 26 with
--conditions=browser; first seen in Chromium - Version: solid-js 2.0.3, @solidjs/signals 2.0.3
Additional context
This looks close to #4354, a branch re-run during the hold that closes it, and to the shown guard from #3948. There the re-run came from an unrelated write; here it comes from the held update itself, with no action or optimistic write. #4137 and #4848 are the other neighbours I found, both fixed.
We met it on a page that polls its data through @tanstack/solid-query 6.0.0-rc.6 and shows a failed job's reason in a non-keyed <Show>. When the job changed state elsewhere, the page logged the error thousands of times and stopped following later polls. We use keyed there now.
- Lenguaje dominante
- TypeScript
- Estrellas
- 37k
- Forks
- 1.2k
- Merge medio
- 8 h 43 min
- PR fusionados (30 d)
- 365
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de solidjs/solid
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 38/100
Los mantenedores suelen responder en 1 día
-
[2.0.4] Nested `<Errored>`: the outer boundary stays on an error the inner one rethrew, after the next error is one the inner one handlesPosiblemente ocupada @MilindChatrabhuji la tomó hace 2 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
Los mantenedores suelen responder en 1 día
Todos los issues de solidjs/solid
Issues similares
-
agentscan:mixed-signals pending triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
vueuse/vueuse#5737 · 2 comentarios ·
Los mantenedores suelen responder en 9 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Marker-Inc-Korea/AutoRAG#2288 ·
Los mantenedores suelen responder en 1 día
-
Resources: New templates of Guangzhou Metro Line 13Posiblemente ocupada @rmt-svc la tomó hoy. Abiertoresources
Dificultad 1/5 Menos de una hora Aptitud para principiantes 76/100
railmapgen/rmg-templates#2730 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
web
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día