Skip to content

Conversation

maraf
Copy link
Member

@maraf maraf commented Aug 13, 2025

Once rel="preload" appears on element, browser eagerly starts to download the file. If we modify existing element, it may happen, based on the order of attributes, that we trigger preloading incorrect asset.

@maraf maraf added this to the 10.0-rc1 milestone Aug 13, 2025
@maraf maraf self-assigned this Aug 13, 2025
@maraf maraf added the area-blazor Includes: Blazor, Razor Components label Aug 13, 2025
@maraf maraf marked this pull request as ready for review August 13, 2025 19:49
@Copilot Copilot AI review requested due to automatic review settings August 13, 2025 19:49
@maraf maraf requested a review from a team as a code owner August 13, 2025 19:49
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 prevents incorrect asset preloading during Blazor enhanced navigation by treating preload elements as new elements that should be replaced rather than updated. The change addresses a browser behavior where modifying existing preload elements can trigger downloading of incorrect assets depending on the order of attribute updates.

  • Introduces logic to always treat preload elements as new during DOM diffing
  • Adds helper function to identify preload elements based on tag name and rel attribute

@maraf maraf merged commit 78b0ad2 into dotnet:main Aug 14, 2025
29 checks passed
@maraf maraf deleted the BlazorPreloadEnhancedNavigation branch August 14, 2025 09:36
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.

2 participants