latest() of an unread identity memo returns undefined when first read in the flush that re-asks its source
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
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
- typescript
- Ambito
- frontend
Direzione di ricerca
Start with the issue’s reproducer and trace the first read of latest(id) alongside isPending(id) when the Loading boundary mounts. Compare that case with creating the identity memo inside the mounted content, where the bug does not occur. Done when the reproducer no longer yields latest(id) === undefined after m has answered, while pending behavior remains correct.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
On next (e49b0c769), latest() can return undefined, which D-22 rules out ("It returns T, never undefined").
Setup:
mis an async memo, andid = createMemo(() => m())is an identity memo created at the root. Nothing readsidyet.m's first answer (2) lands in its own flush.- A write then re-asks
m. In that same flush, aLoadingboundary mounts content whose render effect readslatest(id)andisPending(id).
The effect's first run sees latest(id) === undefined and isPending(id) === true. Because m has been answered, latest(id) should be 2. If id is created inside the mounted content instead, the bug does not happen.
const asks: { v: number; resolve: (v: number) => void }[] = [];
const [s, setS] = createSignal(1);
const m = createMemo(() => { const v = 1 + s(); return new Promise<number>(resolve => asks.push({ v, resolve })); });
const id = createMemo(() => m());
const leaves: string[] = [];
createRoot(() => {
const b = createLoadingBoundary(() => {
const gate = createMemo(() => s() > 1);
return createMemo(() => {
if (!gate()) return "off";
createRenderEffect(() => `l:${latest(id)} p:${isPending(id)}`, v => void leaves.push(v));
return "on";
});
}, () => "fallback");
createRenderEffect(() => { let v: any = b; while (typeof v === "function") v = v(); return v; }, () => {});
});
flush(); await task(); flush();
const first = asks.shift()!; first.resolve(first.v);
await task(); flush(); // m's answer (2) lands on its own
setS(2); await task(); flush(); // re-ask m and mount the content
// leaves: ["l:undefined p:true", ...]
Found while reviewing #4459; #4459 does not change it.
- Lingua principale
- TypeScript
- Stelle
- 36.2k
- Fork
- 1.1k
- Merge medio
- 11h 5m
- PR unite (30g)
- 475
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 28/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 12/100
I maintainer di solito rispondono entro 1 giorno
-
[2.0 / next] <Errored> recovery shows a pending memo's answer to an older input beside the new inputAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 20/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 18/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 62/100
oxidecomputer/skepsis#102 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
voidzero-dev/void#677 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
kunchenguid/gh-axi#247 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
lidge-jun/opencodex#8101 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno