LibreChat/client
Danny Avila 79d1cbbafc
🪶 perf: Cut the Mount Cost of Finished Agent Messages (#16057)
* 🪶 perf: Render a Finished Message's Markdown in One Pass

Opening a conversation rendered every assistant text part per top-level
block: a full mdast parse just to find block boundaries, then one
ReactMarkdown pipeline, two providers and a layout effect per paragraph,
table and fence. The split only pays while a message streams, where it
keeps completed blocks memoized.

A message that was never streamed in this view now renders as one pipeline
and skips the boundary parse, keyed on its source so an in-place edit
remounts it with fresh code and artifact indices. A message that streamed
here keeps the per-block split after it finishes, so ending an answer never
remounts its blocks. The benchmark gains a finished-message mount case.

* 🪪 perf: Keep the Agents List From Re-Rendering Every Message Part

The author header a message hands its parts, restated after an inline
steer, was an element built from the resolved agent. The agents list
resolves after first paint, so that element changed identity, broke the
memo on ContentParts and re-rendered every part of the message, even
though the header only shows after a steer.

Both row renderers now hand the parts one constant header element that
reads the author from AuthorContext. An agent or assistant resolving
re-renders only the headers on screen, and the row's own icon and label
reuse the same memoized author.

* 🧷 fix: Move a Finished Message to Per-Block Rendering on Its First Change

A finished message kept its single pipeline keyed on its source, so every
change remounted all of it. An artifact editor saves the message every few
hundred milliseconds while the user types, and each save collapsed its
expanded Mermaid rows and reset its code blocks, where per-block rendering
had re-rendered only the artifact's block.

The single pipeline now serves a message only while it is exactly as it
mounted. Generating or any content change moves it to per-block rendering
for good, which remounts it once; later changes re-render only the blocks
they touch. The move happens as generation starts, so the fade baseline is
set on the blocks it mounts.

The splitter also sliced each top-level block after its indentation, which
decides how the block parses: an indented fence under a two-digit list item
kept its indentation in the code, and a two-space-indented list turned a note
into a code block. Blocks now keep their line's indentation.
2026-09-18 16:19:19 -04:00
..
public 🍋 feat: Add AMD Lemonade Provider Recognition and Branding (#15664) 2026-09-06 20:46:08 +02:00
src 🪶 perf: Cut the Mount Cost of Finished Agent Messages (#16057) 2026-09-18 16:19:19 -04:00
sw
test 🎨 feat: Theme-Adaptive SVG Support for Custom MCP and Group Icons (#13817) 2026-09-04 10:49:43 -04:00
babel.config.cjs
check_updates.sh
index.html 🔭 feat: Tag Browser Diagnostics With Client Build IDs (#15656) 2026-09-06 12:47:34 -04:00
jest.config.cjs 🧵 ci: Keep a Floor of Two Jest Workers in CI (#15819) 2026-09-14 00:32:20 -04:00
jest.resolver.cjs
nginx.conf
package.json 🚀 v0.8.8-rc3 (#15859) 2026-09-13 02:17:48 -04:00
postcss.config.cjs
tailwind.config.cjs
tsconfig.json
vite.config.ts 🖼️ fix: Precache PWA Icons and Let Them Refresh (#15654) 2026-09-06 11:32:09 -04:00