Repository navigation
[blazor][wasm] use dotnet.download() for InteractiveAuto - #66656
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR optimizes Blazor SSR InteractiveAuto behavior in the Components Web.JS layer by prefetching WebAssembly resources via the runtime’s dotnet.download() API when resources are not yet cached, avoiding full WebAssembly runtime instantiation while a Blazor Server circuit is active.
Changes:
- Update the WebAssembly platform load pipeline to support a “download-only” mode for Auto-rendered components on cold cache.
- Track resource-hash presence in
localStorageto decide whether to prefetch (download-only) vs fully create the runtime. - Adjust an enhanced navigation E2E test to avoid stale element references across SSR→interactive transitions, and update the generated
dotnet.d.tstypings.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Components/Web.JS/src/Services/WebRootComponentManager.ts | Adds Auto-mode decision to use “download-only” when resources aren’t believed cached; persists a cache marker in localStorage. |
| src/Components/Web.JS/src/Platform/Platform.ts | Extends Platform.load signature to accept an optional justDownload flag. |
| src/Components/Web.JS/src/Platform/Mono/MonoPlatform.ts | Implements download-only path using dotnet.download() and defers dotnet.create() until needed. |
| src/Components/Web.JS/src/Boot.WebAssembly.Common.ts | Wires justDownload through the platform load path and conditionally marks the platform as loaded. |
| src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs | Updates staleness checks to use <html> and waits for interactivity before asserting DOM preservation. |
| src/Components/dotnet-runtime-js/dotnet.d.ts | Updates generated runtime typings, including download(httpCacheOnly?: boolean). |
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Member
Author
|
@maraf please review |
maraf
approved these changes
Jun 18, 2026
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.
Fixes #66439
Summary
When an Auto-rendered component triggers WebAssembly resource loading on the first visit (no cached resources), use the runtime's
dotnet.download()API instead ofdotnet.create(). This downloads assets into the browser HTTP cache without instantiating the full WASM runtime, reducing memory pressure and CPU overhead while a Blazor Server circuit is actively serving the page.Motivation
Previously, Auto mode would start the full WebAssembly runtime creation (
dotnet.create()) even when the resources weren't cached yet — meaning the user's first visit would pay the cost of both an active Server circuit and full WASM initialization. The only mitigation was throttling parallel downloads to 1 viamaxParallelDownloads.With this change, on the first visit we only populate the HTTP cache (via
dotnet.download()). On subsequent visits, the resources are already cached and the full runtime is created immediately.