perf(web): skip large sidebar collapse animations - #4345
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Approved Self-contained performance optimization that skips expensive collapse animations for large thread lists (>30 items). Changes are well-tested, limited to UI animation behavior, and have no backend or security implications. You can customize Macroscope's approvability policy. Learn more. |
- Suspend thread-list auto-animation before collapsing more than 30 rendered rows. - Restore animation on the next frame so later expansions keep existing motion. - Add focused threshold coverage and verify a 31-thread fixture in the web app.
7ddbaba to
9a2b417
Compare
Closes #3962
Summary
Verification
./node_modules/.bin/vp test run apps/web/src/components/Sidebar.logic.test.ts(76 passed)./node_modules/.bin/vp run --filter @t3tools/web typechecktest-t3-apprun with a disposable 31-thread fixture: expanded all rows, collapsed with zero retained exit rows, then reopened the project successfullyNote
Low Risk
UI-only performance tweak in sidebar expand/collapse with unit tests for the threshold; no auth, data, or API changes.
Overview
Collapsing a project with more than 30 visible threads no longer runs per-row auto-animate exit animations, avoiding jank when many rows disappear at once.
Adds
shouldSuspendSidebarThreadListAnimationandSIDEBAR_THREAD_LIST_ANIMATION_LIMIT(30) inSidebar.logic.ts. Suspension applies only when the project is expanded andrenderedThreadCountexceeds the limit; smaller lists and already-collapsed projects behave as before.Sidebar.tsxnow keeps a per-DOM-nodeAnimationControllerfrom@formkit/auto-animate(WeakMap instead of WeakSet). Project expand/collapse goes throughtoggleProjectExpanded, which disables animation before updating expansion state and re-enables it on the next frame when suspension applies, so later sidebar motion is unchanged.Reviewed by Cursor Bugbot for commit 9a2b417. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Skip collapse animations in sidebar project thread lists exceeding 30 items
shouldSuspendSidebarThreadListAnimationin Sidebar.logic.ts that returns true when a project is expanded and its rendered thread count exceeds 30 (SIDEBAR_THREAD_LIST_ANIMATION_LIMIT).attachThreadListAutoAnimateRefin Sidebar.tsx to use aWeakMapinstead ofWeakSet, returning a cachedAnimationControllerper DOM node.SidebarProjectItemstores the controller and disables animation before toggling expansion, re-enabling it on the next animation frame — only when suspension applies.Macroscope summarized 9a2b417.