[2.0 / next] A rejection under an armed <Loading on> reveals a stale value and commits a write held outside it
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 18/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- javascript, typescript
- Domaine
- frontend
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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
- Langage dominant
- TypeScript
- Étoiles
- 36.2k
- Forks
- 1.1k
- Merge moyen
- 10 h 39 min
- PR mergées (30 j)
- 500
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de solidjs/solid
-
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 3/5 1-2 jours Accessibilité débutants 55/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
Les mainteneurs répondent en général sous 1 jour
-
[2.0 / next] Optimistic todo list with an "N left" memo loops forever when a toggle's save landsOuverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 15/100
Les mainteneurs répondent en général sous 1 jour
-
[2.0 / next] createOptimisticStore: add, delete, add with saves pending hands <For> an undefined rowOuverte
Difficulté 4/5 3-5 jours Accessibilité débutants 25/100
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de solidjs/solid
Issues similaires
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 85/100
formbricks/formbricks#9918 ·
Les mainteneurs répondent en général sous 1 jour
-
Chat: Resize question overlayOuverteenhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
thecodacus/pithagoras#364 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 72/100
openclimatefix/quartz-frontend#823 ·
Les mainteneurs répondent en général sous 4 jours
-
area:agent-manager community needs-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Les mainteneurs répondent en général sous 1 jour
-
`contacts.create` posts to `/audiences/undefined/contacts` when `audienceId` is undefinedPeut-être pris @RaphaelFakhri l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
resend/resend-node#1176 ·
Les mainteneurs répondent en général sous 1 jour