[signals] A row moved into another keyed createOptimisticStore renders empty under Show when a per-row memo reads the store
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 52/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- javascript, typescript
- Domaine
- frontend
Piste de recherche
Start by running the supplied jsdom reproduction and trace the keyed createOptimisticStore updates alongside the per-row createMemo and nested Show. Compare the failing case with the stated variants that render correctly to isolate the interaction. Done means the moved row renders its text under Show during the outstanding re-asks and the reproduction passes.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
On main 30e7805eb (jsdom). Three keyed createOptimisticStore(async, [], { key: "id" }) lists. Each row in For is Show when={r.id < 0} fallback={<>text<Show when={i() < len - 1}>v</Show></>}, where i is a per-row createMemo doing a findIndex over the store.
A reorder in To do and a move of #4 from Doing to Done are both out. The reorder lands, and its action re-asks all three stores. While those re-asks and the first move of #4 are out, a guess moves #4 back into Doing (a copy of the row). Doing's length becomes 2, and the row before it shows its "v" (so it sees a next row), but the moved card's <i> is empty. Neither Show branch renders.
It renders correctly without the To do reorder, without the outer Show, or with the index read straight into the text instead of through the memo. It may be the same family as #5192 (a moved row renders with no text while held writes are out). That repro uses createOptimistic over a signal. This one uses keyed stores, and the row moves between stores.
/**
* @jsxImportSource @solidjs/web
* @vitest-environment jsdom
*/
import { test, expect } from "vitest";
import { For, Show, Loading, action, createMemo, createOptimisticStore, flush, refresh } from "solid-js";
import { render } from "../src/index.js";
const tick = async () => { for (let i = 0; i < 4; i++) { await new Promise(r => setTimeout(r, 0)); flush(); } };
type C = { id: number; t: string };
test("a row moved into another keyed optimistic store renders empty under Show when a per-row memo reads the store", async () => {
const asks: any[] = [];
const ask = (k: string) => new Promise<any>((res, rej) => asks.push({ k, res, rej }));
const find = (k: string) => asks.splice(asks.findIndex(a => a.k === k), 1)[0];
const placed = (rs: C[], c: C, i: number) => { const n = rs.filter(x => x.id !== c.id); n.splice(i, 0, c); return n; };
const c = document.body.appendChild(document.createElement("div"));
let api: any;
function Board() {
const L: any = {};
for (const k of ["todo", "doing", "done"]) {
const [s, set] = (createOptimisticStore as any)(async () => await ask(k), [], { key: "id" });
L[k] = { s, set };
}
const move = action(function* (card: C, from: string, to: string, i: number) {
if (from !== to) L[from].set((rs: C[]) => rs.filter(x => x.id !== card.id));
L[to].set((rs: C[]) => placed(rs, card, i));
yield ask(`move:${card.id}`);
refresh(L.todo.s); refresh(L.doing.s); refresh(L.done.s);
});
api = { L, move };
const Col = (p: { col: string }) => <Loading fallback="L"><p>{p.col}({L[p.col].s.length}):<For each={L[p.col].s}>{(r: C) => {
const i = createMemo(() => L[p.col].s.findIndex((x: C) => x.id === r.id));
return <i><Show when={r.id < 0} fallback={<>[{r.id} {r.t}]<Show when={i() < L[p.col].s.length - 1}>v</Show></>}>adding</Show></i>;
}}</For></p></Loading>;
return <><Col col="todo" /><Col col="doing" /><Col col="done" /></>;
}
render(() => <Board />, c);
await tick();
find("todo").res([{ id: 1, t: "a" }, { id: 2, t: "b" }]); await tick();
api.move(api.L.todo.s[0], "todo", "todo", 1); await tick(); // reorder in To do
find("doing").res([{ id: 3, t: "c" }, { id: 4, t: "d" }]); await tick();
find("done").res([{ id: 5, t: "e" }]); await tick();
api.move(api.L.doing.s[1], "doing", "done", 1); await tick(); // #4 to Done (its answer never comes)
find("move:1").res({}); await tick(); // the reorder lands; re-asks all three (left out)
expect(c.textContent).toBe("todo(2):[2 b]v[1 a]doing(1):[3 c]done(2):[5 e]v[4 d]");
api.move({ ...api.L.done.s[1] }, "done", "doing", 1); await tick(); // #4 back to Doing (a copy of the row)
expect(c.textContent).toBe("todo(2):[2 b]v[1 a]doing(2):[3 c]v[4 d]done(1):[5 e]");
// actual: "todo(2):[2 b]v[1 a]doing(2):[3 c]vdone(1):[5 e]": #4's row is there but empty
});
Found by an eval app in the ReactiveScript eval (board, a card moved back while the columns re-ask).
- Langage dominant
- TypeScript
- Étoiles
- 37k
- Forks
- 1.2k
- Merge moyen
- 8 h 43 min
- PR mergées (30 j)
- 365
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é 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 1-3 heures Accessibilité débutants 88/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 38/100
Les mainteneurs répondent en général sous 1 jour
-
[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 handlesPeut-être pris @MilindChatrabhuji l’a pris il y a 2 jours. Ouverte
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
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 69/100
activepieces/activepieces#17974 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
OHDSI/Data2Evidence#3777 ·
Les mainteneurs répondent en général sous 3 jours
-
bug enhancement
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100
AOSSIE-Org/PictoPy#1802 · 2 commentaires ·
Les mainteneurs répondent en général sous 3 jours
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
Termix-SSH/Plugin-Snippets#26 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
agent-reported bug from-app needs-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
nightly-labs/openbot#20504 ·
Les mainteneurs répondent en général sous 1 jour