Description
Severity: P2 — Fragility / Performance
In apps/app/src/components/explainer-cards.tsx:141, a MutationObserver is attached to document.body with { childList: true, subtree: true }, which fires on every DOM mutation in the entire app.
Failure mode
Performance degradation on pages with frequent DOM updates (e.g., during agent streaming).
Suggested fix
- Narrow the observer scope: observe only the CopilotKit container element (e.g.,
[data-copilotkit]) instead of document.body
- Add a debounce or
requestIdleCallback to the callback
From self-review finding F06