Skip to content

Conversation

maraf
Copy link
Member

@maraf maraf commented Sep 4, 2025

Enhanced navigation presents several challenges for preloading

  • DOM merging: Preloading elements may be different between pages which may result in different order, resulting in removing and adding elements, resulting in browser triggering more preload requests than necessary.
  • WebAssembly runtime state: When navigating between pages, WebAssembly is not restarting, only for the first page we need a preloading element.

This PR disables generating preloading elements from ResourcePreloader when the HTTP request is for enhanced navigation.
It alsore removes previous attempt to solve the DOM merging problem from #63239

@maraf maraf added this to the 11.0-preview1 milestone Sep 4, 2025
@maraf maraf self-assigned this Sep 4, 2025
@Copilot Copilot AI review requested due to automatic review settings September 4, 2025 11:57
@maraf maraf added the area-blazor Includes: Blazor, Razor Components label Sep 4, 2025
@maraf maraf requested a review from a team as a code owner September 4, 2025 11:57
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR disables resource preloading for enhanced navigation in Blazor to address issues with DOM merging and unnecessary WebAssembly runtime state initialization. Enhanced navigation doesn't need preloading elements since the WebAssembly runtime persists between page navigations.

  • Removes special handling of preload elements during DOM synchronization
  • Adds enhanced navigation detection to skip WebAssembly asset preloading
  • Changes method visibility to enable reuse across components

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
DomSync.ts Removes preload element detection and special handling during DOM comparison
SSRRenderModeBoundary.cs Adds enhanced navigation check to skip WebAssembly asset preloading
EndpointHtmlRenderer.Streaming.cs Changes IsProgressivelyEnhancedNavigation method from private to internal

@javiercn
Copy link
Member

javiercn commented Sep 4, 2025

/backport to release/10.0

/cc: @maraf I imagine we want this in 10.0

Copy link
Contributor

github-actions bot commented Sep 4, 2025

Started backporting to release/10.0: https://github.com/dotnet/aspnetcore/actions/runs/17470161322

@maraf maraf merged commit a813ad4 into main Sep 4, 2025
31 checks passed
@maraf maraf deleted the maraf/BlazorPreloadEnhancedNavigation2 branch September 4, 2025 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-blazor Includes: Blazor, Razor Components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants