Skip to content

Glirastes 0.24.1

Choose a tag to compare

@Piwo96 Piwo96 released this 25 Nov 09:06
· 43 commits to main since this release
628ba75

0.24.0 was tagged but never published (its release preflight found an unreleased note); 0.24.1 is the first published 0.24 and contains everything listed under 0.24.0.

Fixed

  • A chat rendered in the browser before react-markdown had loaded (a reload with createLocalSessionStore, session.load, any history passed in) showed each Markdown text as its raw source for a moment (a list as one flat paragraph, escapes such as Live \+ v2), then the layout jumped. Such a text now shows skeleton lines: div[data-element="markdown-skeleton"][data-state="loading"][aria-busy="true"] inside [data-component="markdown"], with up to 8 span[data-element="markdown-skeleton-line"], a width estimated from the source (at most 40 characters per line, in ch, wrapping so it never widens a narrower container) and a visually hidden loading text for screen readers (not announced). The rule: the skeleton shows only on a client render inside AiChatProvider, while no turn runs (the chat is not submitted or streaming), for a text Markdown could show differently from its raw text (any of a backslash, ` * _ [ ] < > & | ~ # : @, a line break, carriage return, tab or NUL, the zero-width mention marker characters, leading whitespace, a leading -, +, = or 1./1), www. in any case; every text when entity links are on; syntax added by an app's own remark plugins is not recognised, such text stays raw until rendered, as before), and only until react-markdown has loaded. Everything else shows the raw text as before: plain text ("OK", "/Open Overview", a sentence), every bubble while a turn runs (also history that mounts during it), text rendered outside the provider (print, renderToStaticMarkup), server rendering and the hydration render. A bubble keeps what it showed first until Markdown renders, also when a turn starts or ends meanwhile (an approval pause or the moment between continuation requests is not loading: bubbles mounting then get the skeleton, the paused turn's bubbles keep their raw text, both visible at once); it decides again only when its text no longer starts with the text it decided for. While a skeleton shows, the text of its [data-component="markdown"] is the loading label instead of the source; the source is not in the DOM. The copy button copies the source as before; selecting across a skeleton and pressing Ctrl+C copies the hidden label. Its size is inline, so it takes space in a bubble sized by its content, with unstyled and in own layouts; adjust it with --cm-markdown-skeleton-color, --cm-markdown-skeleton-line-height, --cm-markdown-skeleton-gap, --cm-markdown-skeleton-radius, --cm-markdown-skeleton-padding and --cm-markdown-skeleton-max-width. The panel stylesheet adds a pulse, off under prefers-reduced-motion. Server HTML and regular hydration are unchanged (raw text, then Markdown). Declared difference: whenever React builds the chat's messages on the client instead of hydrating them (after a hydration error in the same root or Suspense boundary, before or after the chat, or for a Suspense boundary React renders on the client), a message whose text needs Markdown shows the skeleton instead of the raw source until the renderer has loaded. A finished preloadMarkdown() (or the provider's preload) also lets the first hydration in a page keep server-rendered Markdown without showing its source in between; before, only renders after the renderer had been loaded by an earlier one did. Tests that read the text of such a [data-component="markdown"] right after render now see the label and wait for the rendered Markdown. An own components.Markdown is not affected.