[signals] A row moved into another keyed createOptimisticStore renders empty under Show when a per-row memo reads the store
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 52/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, typescript
- Ambito
- frontend
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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).
- Lingua principale
- TypeScript
- Stelle
- 37k
- Fork
- 1.2k
- Merge medio
- 8h 43m
- PR unite (30g)
- 365
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à 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 38/100
I maintainer di solito rispondono entro 1 giorno
-
[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 handlesForse già presa @MilindChatrabhuji l’ha presa 2 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di solidjs/solid
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 69/100
activepieces/activepieces#17974 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
OHDSI/Data2Evidence#3777 ·
I maintainer di solito rispondono entro 3 giorni
-
bug enhancement
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
AOSSIE-Org/PictoPy#1802 · 2 commenti ·
I maintainer di solito rispondono entro 3 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Termix-SSH/Plugin-Snippets#26 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
agent-reported bug from-app needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
nightly-labs/openbot#20504 ·
I maintainer di solito rispondono entro 1 giorno