Skip to content

Reshape BrowserOptions server-to-client configuration API per review#67918

Draft
javiercn with Copilot wants to merge 3 commits into
mainfrom
copilot/api-proposal-browseroptions
Draft

Reshape BrowserOptions server-to-client configuration API per review#67918
javiercn with Copilot wants to merge 3 commits into
mainfrom
copilot/api-proposal-browseroptions

Conversation

Copilot AI commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Applies the approved API review decisions for the Blazor BrowserOptions surface 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

  • Render-mode property renames on BrowserOptions (get-only, pre-initialized), with [JsonPropertyName] keeping the existing wire keys:
    • ServerInteractiveServer (server)
    • SsrStaticServer (ssr)
    • WebAssemblyInteractiveWebAssembly (webAssembly)
  • Type renames: SsrBrowserOptionsStaticServerBrowserOptions, WebAssemblyBrowserOptionsInteractiveWebAssemblyBrowserOptions (InteractiveServerBrowserOptions unchanged).
  • Accessor moved off HttpContext: removed BrowserOptionsHttpContextExtensions; GetBrowserOptions is now a static method BrowserOptions.GetBrowserOptions(HttpContext).
  • ConfigureBrowser: the HttpContext cascading parameter is now internal, removing it from the public API while remaining functional.
  • Updated internal consumers (EndpointHtmlRenderer, Server.AutoPause, test server startup, Root.razor) and PublicAPI.Unshipped.txt.
  • Added BrowserOptionsTest covering wire-key preservation, TimeSpan→ms conversion, negated PreserveDomdisableDomPreservation, extension-data flattening, GetBrowserOptions caching/metadata seeding, and MergeInto semantics.
app.MapRazorComponents<App>()
    .WithBrowserOptions(options =>
    {
        options.LogLevel = LogLevel.Warning;
        options.InteractiveServer.ReconnectionMaxRetries = 10;
        options.InteractiveServer.ReconnectionRetryInterval = TimeSpan.FromSeconds(1.5);
        options.StaticServer.PreserveDom = true;
        options.InteractiveWebAssembly.EnvironmentName = "Staging";
        options.InteractiveWebAssembly.EnvironmentVariables["OTEL_ENDPOINT"] = "https://...";
    });

Copilot AI and others added 2 commits July 20, 2026 18:38
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
Copilot AI requested a review from javiercn July 20, 2026 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API Proposal: BrowserOptions for server-to-client configuration

2 participants