LocalAI/core/http/react-ui/e2e
LocalAI [bot] 11d5bd0cc3
fix(react-ui/chat): stop wiping selection on every /api/operations poll (#9904) (#9917)
useOperations() was calling setOperations() with a fresh array on every
1s poll, even when the payload was identical. In React 19 the DOM diff
no longer short-circuits dangerouslySetInnerHTML on equal __html, so the
forced Chat re-render re-assigned innerHTML on every assistant message
once per second — wiping any text the user had selected.

Skip the state update when the serialised operations payload is
unchanged, and switch loading/error to functional setters so they also
short-circuit at the source.

Also fixes the chat copy button on plain HTTP: navigator.clipboard is
undefined in non-secure contexts (a common LXC+Docker deployment), but
the previous code called it unconditionally and showed a success toast
regardless. Routed Chat, AgentChat and CanvasPanel through a new
copyToClipboard() helper that uses navigator.clipboard when available
and falls back to a hidden-textarea + execCommand('copy') trick that
browsers still honour outside secure contexts. The fallback preserves
the user's existing selection.

Regression coverage in e2e/chat-polling-selection.spec.js: a
MutationObserver counts mutations on the assistant content node across
3s of polling (must be 0); the copy test stubs out navigator.clipboard
and asserts that execCommand('copy') is invoked.


Assisted-by: claude-opus-4-7-1m

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
2026-05-21 12:17:51 +02:00
..
audio-transform.spec.js feat: add LocalVQE backend and audio transformations UI (#9640) 2026-05-04 22:07:11 +02:00
backend-logs.spec.js feat(ui): Per model backend logs and various fixes (#9028) 2026-03-18 08:31:26 +01:00
chat-errors.spec.js feat(ui, openai): Structured errors and link to traces in error toast (#9068) 2026-03-20 15:06:07 +01:00
chat-polling-selection.spec.js fix(react-ui/chat): stop wiping selection on every /api/operations poll (#9904) (#9917) 2026-05-21 12:17:51 +02:00
import-form-ux-batch-a.spec.js feat(importer): expand importer flow to almost all backends (#9466) 2026-04-22 22:42:37 +02:00
import-form-ux-batch-b.spec.js feat(importer): expand importer flow to almost all backends (#9466) 2026-04-22 22:42:37 +02:00
import-form-ux-batch-d.spec.js fix(react-ui/e2e): scope backendTrigger to <main> so it skips LanguageSwitcher 2026-05-04 08:58:25 +00:00
import-form-ux-batch-e.spec.js fix(react-ui/e2e): scope backendTrigger to <main> so it skips LanguageSwitcher 2026-05-04 08:58:25 +00:00
import-form-ux-batch-f.spec.js feat(importer): expand importer flow to almost all backends (#9466) 2026-04-22 22:42:37 +02:00
manage-logs-link.spec.js test(react-ui): drive Manage page Backend logs link via the new kebab menu 2026-04-26 20:51:01 +00:00
media-history.spec.js feat(ui): Add media history to studio pages (e.g. past images) (#9151) 2026-03-30 00:49:55 +02:00
model-config.spec.js feat(ui): Interactive model config editor with autocomplete (#9149) 2026-04-07 14:42:23 +02:00
models-gallery.spec.js feat(gallery): Speed up load times and clean gallery entries (#9211) 2026-05-06 14:51:38 +02:00
navigation.spec.js feat: add quota system (#9090) 2026-03-21 10:09:49 +01:00
nodes-per-node-backend-actions.spec.js feat(distributed): support multiple replicas of one model on the same node (#9583) 2026-04-27 21:20:05 +02:00
settings-backend-logging.spec.js feat(ui, openai): Structured errors and link to traces in error toast (#9068) 2026-03-20 15:06:07 +01:00
traces-errors.spec.js feat(ui): Per model backend logs and various fixes (#9028) 2026-03-18 08:31:26 +01:00
traces.spec.js feat(ui, openai): Structured errors and link to traces in error toast (#9068) 2026-03-20 15:06:07 +01:00