Mermaid shows an error for a partial chart while its fence is still streaming
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- react, typescript
- Ambito
- frontend
Direzione di ricerca
The error is set in the failed-render path of lib/mermaid/index.tsx, which runs on every change to chart, and useIsCodeFenceIncomplete() only pauses renders. Open PR #668 is already linked and addresses this, so check it before starting. Done means no error box while the fence is still open, and an error only after the closing fence arrives with a chart that still fails.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
While a fenced mermaid block is still streaming, Streamdown can show a "Mermaid Error" box for the partial chart. The error appears before the closing fence arrives. It goes away once a later partial chart renders, so the user sees a false error mid-stream.
@farnabaz for triage.
Versions
streamdown2.7.0@streamdown/mermaid1.0.2 (withmermaid11.15.0)
Reproduction
Stream a markdown response token by token into <Streamdown isAnimating plugins={{ mermaid }}> where the response contains a flowchart fence:
```mermaid
graph TD;
A-->B
B--
```
The chart before the closing fence is incomplete (for example graph TD;\n A--). Mermaid fails to parse it.
What happens
lib/mermaid/index.tsx handles a failed render with setError(...). The error is shown whenever there is no valid SVG yet to display. So the first partial chart that fails to parse shows the error while the fence is still open. Mermaid then renders a later partial chart and clears the error, so the box appears and disappears during the stream.
This happens because the component renders on every change to chart, including while the fence is open. The useIsCodeFenceIncomplete() check only pauses renders (#632). It doesn't suppress errors.
Expected
While the fence is still streaming, a failed render should not show an error. The component should keep showing the loader. The error should show once the fence closes and the final chart fails to render.
Notes
- The error does not appear when a valid SVG is already on screen, because the last valid SVG is kept.
- A fix PR is coming with tests for both the streaming and closed-fence cases.
- Lingua principale
- TypeScript
- Stelle
- 5.7k
- Fork
- 307
- Merge medio
- 1g 22h
- PR unite (30g)
- 22
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 vercel/streamdown
-
`mode="static"` parses the whole document twice on mount (since the caret host in 2.7)Forse già presa @akhil9tiet l’ha presa 1 giorno fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
vercel/streamdown#673 · 3 commenti · 2 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
remend: unclosed `$$` in a table cell is closed on a new line when an earlier line has mathForse già presa @orinnz l’ha presa 13 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
vercel/streamdown#652 ·
I maintainer di solito rispondono entro 1 giorno
-
`data-*` and `aria-*` props passed to `<Streamdown>` are never set on its root elementForse già presa @xyrolle l’ha presa 1 giorno fa. Aperta
Difficoltà 3/5 Mezza giornata Idoneità per principianti 55/100
vercel/streamdown#675 ·
I maintainer di solito rispondono entro 1 giorno
-
CJK autolink boundary handling keeps `**` in the URL when a bold URL is followed by CJK punctuationForse già presa @mikemikimike l’ha presa 1 giorno fa. Apertabug
Difficoltà 3/5 Mezza giornata Idoneità per principianti 50/100
vercel/streamdown#672 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
vercel/streamdown#669 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di vercel/streamdown
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
bug category:ai category:devices effort:s
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
LanternOps/breeze#8943 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
area:reliability difficulty:easy help wanted points:100 Stellar Wave
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
Divinity-Labs/Lens#341 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno