mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-09-16 17:46:20 +00:00
* perf(frontend): cache settled copy-data derivation across streaming chunks Every SSE values chunk re-renders MessageList, and the re-render re-derived copy/toolbar text for every settled row: getAssistantTurnCopyData re-ran the O(turn bytes) content extraction per settled group, and MessageListItem's toolbar recomputed getMessageCopyData per message. Settled group arrays keep their identity across chunks (deriveStableMessageGroups), so both derivations now cache on that stable reference: a WeakMap keyed on the messages array for turn copy data, and a useMemo on message identity for the toolbar copy text. Fixes #5094 * fix(frontend): gate row copy-data memo and correct cache win claim Address review: derive one memoized copy value only when isHuman || (!isLoading && showCopyButton) and reuse it for both editing and the toolbar, so settled assistant rows (whose toolbar never renders) skip the derivation and human rows derive once, not twice; correct the assistantTurnCopyDataCache comment — the regex/trim split is already cached per message, the cache's win is the traversal/allocations for string turns and the uncached O(bytes) map/join/trim for array-content turns (benchmarked: 5.1x / 17.2x per settled history sweep). * style(frontend): expand single-line messages array for Prettier