Coalesce component renders during Blazor WebAssembly startup #12753#12754
Coalesce component renders during Blazor WebAssembly startup #12753#12754yasmoradi wants to merge 1 commit into
Conversation
|
Important Review skippedAuto incremental 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 Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughChangesStartup render coalescing
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Component
participant AppComponentBase
participant ITimer
participant Renderer
Component->>AppComponentBase: Trigger StateHasChanged
AppComponentBase->>AppComponentBase: Suppress intermediate render
AppComponentBase->>ITimer: Schedule trailing render
ITimer->>Renderer: InvokeAsync(StateHasChanged)
Renderer->>AppComponentBase: Execute trailing render
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/AppComponentBase.Rendering.cs`:
- Line 26: Initialize the passCoalescedRender field in
AppComponentBase.Rendering to false instead of true, preserving the existing
timer-based coalescing behavior after Blazor’s unconditional initial render.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 97423195-5e6b-4249-9e6a-804a7577881f
📒 Files selected for processing (7)
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/AppComponentBase.Rendering.cssrc/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/AppComponentBase.cssrc/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/AppAiChatPanel.razor.cssrc/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/AppShell.razor.cssrc/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/Header/Header.razor.cssrc/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/NavBar.razor.cssrc/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Home/HomePage.razor.cs
71ca232 to
457b29b
Compare
457b29b to
334b830
Compare
Summary
Adds an opt-in render-coalescing mechanism to
AppComponentBasethat collapses a burst ofStateHasChangedcalls 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
AppComponentBase.Rendering.cs: overridesShouldRenderto debounce renders during the startup window. Suppressed renders (re)arm a single trailing render so the final startup state is guaranteed to paint. Tunable viaCoalesceRendersDuration(default 3s, measured from app start) andCoalesceRendersWindow(default 300ms quiet period). Only runs whenAppPlatform.IsBrowser; everything else renders normally.AppComponentBase.cs: adds aDisposeRenderCoalescing()partial invoked fromDisposeAsyncso the coalescing timer is always released; the whole feature stays isolated in its own file and compiles away when absent.CoalesceRenders => true) forAppShell,Header,NavBar,HomePage, andAppAiChatPanel.Related Issue
This closes #12753
Summary by CodeRabbit