fix(web): stop animating an idle sidebar thread list - #9502
Open
ylcn91 wants to merge 2 commits into
Open
Conversation
Contributor
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This production UI change makes sidebar rows snap instead of animate under the existing default motion setting, while retaining opt-in animations and adding cleanup for polling controllers. Because it changes the user-visible product default behavior, human review is required. You can add or adjust custom eligibility rules. Learn more. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
apps/web/src/components/Sidebar.tsxandapps/web/src/components/LegacySidebar.tsx: the sidebar lists attach@formkit/auto-animateonly while the Motion setting is active (Settings → Appearance → Motion above 0 ms, and noprefers-reduced-motion), the same rule the panels already follow throughusePanelAnimationSettings. The row slide keeps its previous cap (150 ms in the default sidebar, 180 ms in the legacy one), bounded by the slider. The ref callbacks now return a cleanup that destroys the controller, so a detached or remounted list stops polling instead of leaving its timers behind; the legacy sidebar's two WeakSet-guarded callbacks become one.docs/user/thread-sidebar.md: the Panel motion section says thread rows follow the same setting.This is a visible change at the default setting: thread rows no longer slide when they appear, move between sections, or leave. They snap, as the panels already do at 0 ms. Turning Motion up brings the slide back.
Why
Fixes #4693.
auto-animate 0.9.0 polls the position of the container and every direct child for as long as it is attached (
index.mjs,poll): a 2 ssetIntervalper element, and every tick schedules an idle callback, aduration-long timer, a forced layout read and a freshly constructedIntersectionObserver. The thread list has hundreds of rows, so an idle app ran on the order of a hundred polls a second. The reporter measured 26% CPU idle and 2.3% with reduced motion forced, which is exactly the flag that makes the library skippoll. The old ref callbacks also never destroyed a controller, so each remount of the list (toggling thread search, for instance) added another full set of pollers.The panels already define the product's motion model: immediate by default, one slider to add motion. The list animation bypassed that model and paid for itself even while nothing on screen was moving. Following the same setting removes the idle cost for every default install, gives an in-app switch instead of the OS-level workaround, and keeps the animation for people who asked for motion. While Motion is on the library still polls; dropping it entirely would be a separate decision.
Verified with web lint and typecheck. No CPU measurement was taken in a running app; the numbers above are the reporter's.
Model and harness: Claude Fable 5.1 in Claude Code.
Note
Low Risk
UI/performance change in sidebar list mounting only; default behavior becomes instant row updates with no animation until Motion is enabled.
Overview
Fixes idle CPU use from
@formkit/auto-animatecontinuously polling large sidebar lists (#4693).Sidebar and LegacySidebar now attach
auto-animateonly when Settings → Appearance → Motion panel duration is above 0 ms and reduced motion is off—the sameusePanelAnimationSettingsrule panels already use. At the default 0 ms, thread (and legacy project) rows snap instead of sliding; raising the slider restores list motion, capped at the existing per-sidebar durations (150 ms / 180 ms).Ref callbacks destroy the auto-animate controller on detach so remounts (e.g. thread search) do not stack pollers; legacy sidebar merges its two WeakSet-guarded attach helpers into one shared callback.
User docs in
thread-sidebar.mdnote that thread rows follow the panel motion setting.Reviewed by Cursor Bugbot for commit 84e2cd1. Configure here.
Note
Stop sidebar thread list animation when panel motion is inactive
SidebarandLegacySidebarMacroscope summarized 9a1553a.