Skip to content

Expanded session sidebar stalls the page: SVG SMIL pulse in the new-activity indicator (2–4 fps, ~450 ms keystroke lag) #552

Open

Description

@kojilab-dev

Summary

With the session sidebar fully expanded ("Show N more"), the page drops to 2–4 fps and typing in the composer lags by about 450 ms per keystroke. The cause is the SVG SMIL <animate> pulse in the sidebar's "new activity" indicator (sessionSidebar.newActivity). Each animated SVG costs main-thread time on every frame, and that cost grows with the size of the DOM.

Environment

  • ompweb 0.7.4 (npm), omp 19.1.0
  • Chrome 157, macOS, Apple Silicon (Mac mini)
  • About 700 sessions in one project; 28 of them showed the "new activity" indicator (many are agent child sessions that are never opened)

Steps to reproduce

  1. Have a project with several hundred sessions, where a few dozen show the "new activity" indicator.
  2. Click "Show N more" in the sidebar so all rows render (about 20k DOM nodes in our case).
  3. Type in the composer.

Measurements

State Frame rate Keystroke latency (Event Timing, p50)
Sidebar collapsed 60 fps ~48 ms
Sidebar expanded (28 SMIL indicators) 2–4 fps ~450 ms (10 characters took 4.5 s)
Sidebar expanded, <animate> elements removed 60 fps ~64 ms
  • Long Animation Frame entries showed 150–850 ms frames. Almost all of the time falls between renderStart and styleAndLayoutStart. Scripts are nearly absent, with no DOM mutations and no page requestAnimationFrame calls.
  • The frame rate tracks the number of animated SVGs on the expanded list: 28 → 2–4 fps, 14 → 7 fps, 1 → 38 fps, 0 → 60 fps.
  • Pausing the CSS keyframe animations (sidebar-running-spin, sidebar-activity-*) made no difference. Removing only the SMIL <animate> elements fixed it.
  • 30 copies of an equivalent CSS animation (transform: scale() + opacity on the circle with transform-box: fill-box; transform-origin: center) on the same expanded page ran at 58 fps.
  • React is not the bottleneck: a keystroke re-renders only about 22 components.

Offending code (from the built bundle)

!l && r("circle", { cx: "7", cy: "7", r: "3", stroke: "currentColor", strokeWidth: "1.4", opacity: "0.32", children: [
  e("animate", { attributeName: "r", values: "3;6;3", dur: "1.6s", repeatCount: "indefinite" }),
  e("animate", { attributeName: "opacity", values: "0.32;0;0.32", dur: "1.6s", repeatCount: "indefinite" })
] })

(l is prefers-reduced-motion.)

Suggested fix

  1. Replace the SMIL pulse with a CSS keyframe animation on transform and opacity, similar to the existing sidebar-activity-ring.
  2. Optionally, virtualize or window the expanded session list, so that the DOM size (and the per-frame cost of anything that animates) stays bounded with hundreds of sessions.

Workaround we use locally

An inline script in dist/index.html makes document.createElementNS(SVG_NS, "animate" | "animateMotion" | "animateTransform") return a <metadata> element instead. The indicator stays visible without pulsing, and the expanded sidebar runs at 60 fps.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions