Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger enhanced page nav on hot reload #35450

Merged
merged 1 commit into from
Sep 18, 2023
Merged

Conversation

captainsafia
Copy link
Member

@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)

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, dotnet-watch 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
Member 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.

@mkArtakMSFT mkArtakMSFT merged commit 937d4c9 into release/8.0.1xx Sep 18, 2023
16 checks passed
@mkArtakMSFT mkArtakMSFT deleted the safia/bhr-script branch September 18, 2023 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, dotnet-watch untriaged Request triage from a team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants