Skip to content

perf(shell): prevent workspace LayoutBuilder and layout rebuilds during sidebar toggle (#984) - #1019

Merged
ZhuchkaTriplesix merged 1 commit into
devfrom
issue/984-sidebar-toggle-layout-optimization
Sep 27, 2026
Merged

ZhuchkaTriplesix merged 1 commit into
devfrom
issue/984-sidebar-toggle-layout-optimization

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Closes #984

Summary

Resolves the remaining scope of #984 (following Part 1's #1004 LazyOffstage):

  • In _MainContentSplitState, during _widthSpring animation ticks (toggleSidebar and drag flings), Expanded previously computed a new width on each frame (maxWidth - currentW - currentHandleW), forcing full performLayout passes down the visible workspace and rebuilding active LayoutBuilder elements (WorkspaceEmptyHero, VirtualResultGrid, DataGridStagingToolbar, etc.) on every single tick (~3.4–4.6ms per frame).
  • Decouples workspace laid-out constraints from intermediate animation frames using ClipRect and OverflowBox(alignment: Alignment.topLeft), holding constraints stable at constraints.maxWidth while animating. Flutter's RenderObject.layout early-exits in O(1) across intermediate frames, eliminating per-frame reflows and LayoutBuilder rebuilds completely.
  • When settled at rest, the workspace lays out against the final settled width once.
  • Interactive mouse dragging retains live constraint updates.
  • Added comprehensive widget test in sidebar_toggle_test.dart verifying stable constraints across intermediate ticks for both collapse and expand animations.

@github-actions github-actions Bot added performance Theme parser epic label: performance motion Animation system, transitions, motion tokens ui User interface components and widgets labels Sep 27, 2026
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit 16d129e into dev Sep 27, 2026
3 checks passed
@ZhuchkaTriplesix
ZhuchkaTriplesix deleted the issue/984-sidebar-toggle-layout-optimization branch September 28, 2026 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

motion Animation system, transitions, motion tokens performance Theme parser epic label: performance ui User interface components and widgets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant