Memo over an error boundary output: a rejection during a held change halts uncaught

Chiusa
#4,640 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

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
18/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
javascript, typescript
Ambito
frontend

Direzione di ricerca

Start with the reproduction in the issue: createErrorBoundary wrapping a memo over a promise, then a memo over the boundary output, flushed during a held change. Compare the render-effect-reads-boundary case, which works, with the memo case, which halts. The scheduler's handling of held changes and rejected sources in the signals package is where the fix would live. Done means the second rejection is caught by the boundary, the render effect shows ERR, and nothing escapes as an uncaught error.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

A memo over an error boundary's output halts the scheduler when the boundary's source rejects during a held change. The rejection escapes as an uncaught error, and the screen stays on the old value instead of showing the boundary's fallback. If the render effect reads the boundary output directly, the fallback shows as expected.

import { createErrorBoundary, createMemo, createRenderEffect, createRoot, createSignal, flush, untrack } from "@solidjs/signals";

const asks = [];
let screen = "-";
const [sel, setSel] = createSignal(3);
createRoot(() => {
  const detail = createMemo(() => { sel(); return new Promise((res, rej) => asks.push({ res, rej })); });
  const shown = untrack(() => createErrorBoundary(() => detail(), () => "ERR"));
  const t = createMemo(() => shown());            // remove this memo and it works
  createRenderEffect(() => t(), v => { screen = v; });
});
// settle first ask with "A"  -> screen "A"
// setSel(1); flush()         -> held change, screen "A"
// reject second ask "boom"   -> uncaught "boom", screen stays "A" (expected "ERR")
shape after reject
render effect reads the boundary output directly ERR
render effect reads a memo over the output uncaught boom, screen A

The same uncaught error shows up when the memo is read under a <Loading> (without on). The bug is on next. Review of #4639 found it while probing error boundaries built outside a Loading.


Generated by Claude Code

Lingua principale
TypeScript
Stelle
36.2k
Fork
1.1k
Merge medio
10h 10m
PR unite (30g)
505

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di solidjs/solid

Tutte le issue di solidjs/solid

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.