Skip to content

Trigger enhanced page nav on hot reload#35450

Merged
mkArtakMSFT merged 1 commit intorelease/8.0.1xxfrom
safia/bhr-script
Sep 18, 2023
Merged

Trigger enhanced page nav on hot reload#35450
mkArtakMSFT merged 1 commit intorelease/8.0.1xxfrom
safia/bhr-script

Conversation

@captainsafia
Copy link
Contributor

@captainsafia captainsafia commented Sep 15, 2023

Depends on dotnet/aspnetcore#50437.

Addresses dotnet/aspnetcore#49144.

Scenario Validated
Statically server rendered page
Interactive server rendered page
Page with stream rendering enabled
Interactive client rendered page ❌ (dotnet/aspnetcore#50765)
Statically server rendered page with interactive components (all render modes)

@ghost ghost added Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, StaticWebAssetsSDK untriaged Request triage from a team member labels Sep 15, 2023
@captainsafia captainsafia marked this pull request as ready for review September 18, 2023 02:37
@captainsafia captainsafia requested a review from a team as a code owner September 18, 2023 02:37
// Blazor SSR.
if (window.Blazor?._internal?.hotReloadApplied)
{
Blazor._internal.hotReloadApplied();
Copy link
Member

Choose a reason for hiding this comment

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

From reading Boot.Web.ts in dotnet/aspnetcore, hotReloadApplied is defined as:

  Blazor._internal.hotReloadApplied = () => {
    if (hasProgrammaticEnhancedNavigationHandler()) {
      performProgrammaticEnhancedNavigation(location.href, true);
    }
  };

It looks like that will do nothing if options.ssr.disableDomPreservation is set to true. Do we also need something else to make hot reload work in that case? For example we could add an else block that forces a full-page load.

I appreciate you can't do that in this PR since that's in a different repo. Just check if that's something we need to follow up on today!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Opened dotnet/aspnetcore#50790 to follow up.

@SteveSandersonMS SteveSandersonMS self-requested a review September 18, 2023 08:47
Copy link
Member

@SteveSandersonMS SteveSandersonMS left a comment

Choose a reason for hiding this comment

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

Looks good! Added a comment about one thing that might need followup but I'm unsure since maybe it's being handled some other way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, StaticWebAssetsSDK untriaged Request triage from a team member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants