Reshape BrowserOptions server-to-client configuration API per review - #67918
Merged
Conversation
Co-authored-by: javiercn <6995051+javiercn@users.noreply.github.com>
Co-authored-by: javiercn <6995051+javiercn@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update API for BrowserOptions configuration
Reshape BrowserOptions server-to-client configuration API per review
Jul 20, 2026
javiercn
marked this pull request as ready for review
July 24, 2026 08:13
Contributor
There was a problem hiding this comment.
Pull request overview
Reshapes the Blazor BrowserOptions server-to-client configuration API (used for the <!--Blazor-Configuration:{...}--> payload) to match the approved API review: renamed render-mode option properties/types while preserving existing wire keys, and moved GetBrowserOptions off HttpContext extensions onto BrowserOptions.
Changes:
- Renamed
BrowserOptionssub-option properties toInteractiveServer,StaticServer, andInteractiveWebAssembly, using[JsonPropertyName]to preserveserver,ssr, andwebAssemblywire keys. - Replaced
BrowserOptionsHttpContextExtensions.GetBrowserOptions(HttpContext)withBrowserOptions.GetBrowserOptions(HttpContext)and updated call sites. - Updated public API declarations and added tests validating serialization/wire compatibility and option merging/caching behavior.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Components/test/testassets/Components.TestServer/RazorComponentEndpointsStartup.cs | Updates test server configuration to use InteractiveWebAssembly property. |
| src/Components/Server.AutoPause/src/AutoPauseBrowserOptionsExtensions.cs | Updates auto-pause option injection to target InteractiveServer extensions. |
| src/Components/Endpoints/test/BrowserOptionsTest.cs | Adds tests for wire-key preservation, converters, extension-data flattening, caching, and merge semantics. |
| src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.Streaming.cs | Switches to BrowserOptions.GetBrowserOptions(HttpContext) and updates WebAssembly defaults to InteractiveWebAssembly. |
| src/Components/Endpoints/src/PublicAPI.Unshipped.txt | Reflects public API renames and removes the HttpContext extension API surface. |
| src/Components/Endpoints/src/BrowserConfiguration/StaticServerBrowserOptions.cs | Renames SsrBrowserOptions to StaticServerBrowserOptions and updates docs. |
| src/Components/Endpoints/src/BrowserConfiguration/InteractiveWebAssemblyBrowserOptions.cs | Renames WebAssemblyBrowserOptions to InteractiveWebAssemblyBrowserOptions. |
| src/Components/Endpoints/src/BrowserConfiguration/ConfigureBrowser.cs | Makes the cascading HttpContext parameter internal and updates merge logic to new property names. |
| src/Components/Endpoints/src/BrowserConfiguration/BrowserOptionsHttpContextExtensions.cs | Removes the HttpContext extension-based accessor. |
| src/Components/Endpoints/src/BrowserConfiguration/BrowserOptions.cs | Introduces BrowserOptions.GetBrowserOptions(HttpContext) and applies JsonPropertyName to preserve existing wire keys. |
ilonatommy
approved these changes
Jul 24, 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.
Applies the approved API review decisions for the Blazor
BrowserOptionssurface that flows host configuration to the browser client via the<!--Blazor-Configuration:{...}-->DOM comment. The wire format is preserved through JSON converters/attributes, so no JS changes are required.Description
BrowserOptions(get-only, pre-initialized), with[JsonPropertyName]keeping the existing wire keys:Server→InteractiveServer(server)Ssr→StaticServer(ssr)WebAssembly→InteractiveWebAssembly(webAssembly)SsrBrowserOptions→StaticServerBrowserOptions,WebAssemblyBrowserOptions→InteractiveWebAssemblyBrowserOptions(InteractiveServerBrowserOptionsunchanged).HttpContext: removedBrowserOptionsHttpContextExtensions;GetBrowserOptionsis now a static methodBrowserOptions.GetBrowserOptions(HttpContext).ConfigureBrowser: theHttpContextcascading parameter is nowinternal, removing it from the public API while remaining functional.EndpointHtmlRenderer,Server.AutoPause, test server startup,Root.razor) andPublicAPI.Unshipped.txt.BrowserOptionsTestcovering wire-key preservation,TimeSpan→ms conversion, negatedPreserveDom→disableDomPreservation, extension-data flattening,GetBrowserOptionscaching/metadata seeding, andMergeIntosemantics.Fixes #66393.