Skip to content

Coalesce component renders during Blazor WebAssembly startup #1 - #2

Closed
yasmoradi wants to merge 1 commit into
developfrom
perf/1-coalesce-wasm-startup-renders
Closed

Coalesce component renders during Blazor WebAssembly startup #1#2
yasmoradi wants to merge 1 commit into
developfrom
perf/1-coalesce-wasm-startup-renders

Conversation

@yasmoradi

Copy link
Copy Markdown
Owner

Summary

Adds an opt-in render-coalescing mechanism to AppComponentBase that collapses a burst of StateHasChanged calls during the app startup window into a single trailing render. It is active only on Blazor WebAssembly (where startup rendering is the bottleneck) and disabled by default.

Changes

  • New AppComponentBase.Rendering.cs: overrides ShouldRender to debounce renders during the startup window. Suppressed renders (re)arm a single trailing render so the final startup state is guaranteed to paint. Tunable via CoalesceRendersDuration (default 3s, measured from app start) and CoalesceRendersWindow (default 300ms quiet period). Only runs when AppPlatform.IsBrowser; everything else renders normally.
  • AppComponentBase.cs: adds a DisposeRenderCoalescing() partial invoked from DisposeAsync so the coalescing timer is always released; the whole feature stays isolated in its own file and compiles away when absent.
  • Opt in (CoalesceRenders => true) for AppShell, Header, NavBar, HomePage, and AppAiChatPanel.

Related Issue

This closes #1

@yasmoradi yasmoradi added performance Speed or memory improvements area / templates Relates to the bit Boilerplate project template labels Jul 22, 2026
@yasmoradi

Copy link
Copy Markdown
Owner Author

Superseded: opened on upstream as bitfoundation#12754. This fork PR was created by mistake.

@yasmoradi yasmoradi closed this Jul 22, 2026
@yasmoradi
yasmoradi deleted the perf/1-coalesce-wasm-startup-renders branch July 22, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area / templates Relates to the bit Boilerplate project template performance Speed or memory improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Blazor WebAssembly startup re-renders components once per StateHasChanged

1 participant