Skip to content

sessions: fix spinner animation restart and respect reduced motion#312219

Merged
hawkticehurst merged 2 commits intomainfrom
agents/fix-spinner-re-render-and-motion-preference
Apr 23, 2026
Merged

sessions: fix spinner animation restart and respect reduced motion#312219
hawkticehurst merged 2 commits intomainfrom
agents/fix-spinner-re-render-and-motion-preference

Conversation

@hawkticehurst
Copy link
Copy Markdown
Member

Summary

Fixes two issues with the session list spinner icon in the agents/sessions sidebar:

1. Spinner animation glitch

The loading spinner (codicon-loading with spin modifier) was restarting its CSS animation on every tree re-render. The tree calls renderElement on all visible rows whenever the session list is spliced (e.g. when chat progress text updates), which clears elementDisposables and recreates the icon autorun. The icon CSS selector tracking was in a local variable that reset to undefined each time, causing the spinner DOM element to be destroyed and recreated — restarting the animation.

Fix: Move the icon selector tracking onto ISessionItemTemplate so it persists across renderSession calls for the same row. The spinner DOM element now stays alive and its animation continues smoothly.

2. Reduced motion preference

When the user has reduced motion enabled (via workbench.reduceMotion setting or OS-level prefers-reduced-motion), the animated spinner is now replaced with the static session-in-progress codicon. The icon reactively updates when the preference changes via observableSignalFromEvent on onDidChangeReducedMotion.

Fix the session list spinner (loading icon) animation restarting on
every tree re-render. The tree calls renderElement on all visible rows
whenever the list is spliced, which clears elementDisposables and
recreates the icon autorun. The icon CSS selector tracking was stored in
a local variable that reset to undefined each time, causing the spinner
DOM to be rebuilt and the CSS animation to restart.

Move the icon selector tracking onto the template object so it persists
across renderSession calls for the same row. The spinner element now
stays alive and its animation continues smoothly.

Also add reduced motion support: when the user has reduced motion enabled
(via workbench.reduceMotion or system preference), show the static
session-in-progress codicon instead of the animated loading spinner. The
icon reactively updates when the preference changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 23, 2026 20:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Agents/Sessions sidebar session-row status icon rendering to (1) prevent the loading spinner’s CSS animation from restarting on frequent tree re-renders and (2) respect the user’s reduced-motion preference by switching from an animated spinner to a static icon.

Changes:

  • Persist icon identity across renderSession calls by tracking the current icon selector on the row template to avoid unnecessary DOM rebuilds (and animation restarts).
  • Replace the spinning loading icon with a static session-in-progress icon when reduced motion is enabled.
  • Wire reduced-motion changes into the row’s reactive render flow via observableSignalFromEvent and IAccessibilityService.

Comment thread src/vs/sessions/contrib/sessions/browser/views/sessionsList.ts Outdated
Comment thread src/vs/sessions/contrib/sessions/browser/views/sessionsList.ts Outdated
- Hoist observableSignalFromEvent to a renderer-level field so it's
  shared across all rows instead of recreated on every renderSession.
- Always update iconSpan.style.color even when the selector hasn't
  changed, fixing stale color when the same codicon is used with
  different theme colors (e.g. circleFilled for both NeedsInput and
  unread states).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@hawkticehurst hawkticehurst merged commit f46e6eb into main Apr 23, 2026
26 checks passed
@hawkticehurst hawkticehurst deleted the agents/fix-spinner-re-render-and-motion-preference branch April 23, 2026 22:20
@vs-code-engineering vs-code-engineering Bot added this to the 1.118.0 milestone Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants