Skip to content

[release/8.0] Fix NavigationManager.Refresh() on SSR-only pages #52767

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

Merged
merged 4 commits into from
Jan 10, 2024

Conversation

surayya-MS
Copy link
Member

@surayya-MS surayya-MS commented Dec 12, 2023

Fix NavigationManager.Refresh() on SSR-only pages

Manual backport of #52559

Description

  1. This PR fixes NavigationManager.Refresh() on SSR-only pages
@page "/"
@inject NavigationManager Nav

<form @onsubmit="@(() => Nav.Refresh())" @formname="myform" method="post">
    <AntiforgeryToken />
    <button>Submit</button>
</form>
  • When trying the example above in Blazor Web App with no interactivity it results in browser showing NotImplementedException
  • When trying same thing in Blazor Web App with Server interactivity then the console shows System.ArgumentNullException and no Refresh is happenning.
  1. This PR changes the behavior in case when enhanced navigation is on and the location doesn't change then do not push new history entry. This affects NavigationManager.Refresh() andNavigationManager.NavigateTo({current url}).

Fixes #51222
Fixes #51482

Customer Impact

Without this change customers will not be able to use NavigationManager.Refresh() in SSR-only pages. Also, the behavior for NavigationManager.NavigateTo({current url}) changes - no history entry is pushed.

Regression?

  • Yes
  • No

[If yes, specify the version the behavior has regressed from]

Risk

  • High
  • Medium
  • Low

This is a minor change. There are e2e tests for this change as well as manual testing was done.
The important thing is that newly introduced enhanced navigation feauture's behavior is changed in this PR: when enhanced navigation is on `NavigationManager.NavigateTo({current url}) doesn't push new history entry (it did that before). Hence this should be patched as soon as possible.

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

When servicing release/2.1

  • Make necessary changes in eng/PatchConfig.props

* implement NavigationManager.Refresh() on ssr pages

---------

Co-authored-by: Steve Sanderson <[email protected]>
@surayya-MS surayya-MS requested a review from a team as a code owner December 12, 2023 15:19
@surayya-MS surayya-MS added the Servicing-consider Shiproom approval is required for the issue label Dec 12, 2023
@ghost ghost added the area-blazor Includes: Blazor, Razor Components label Dec 12, 2023
@ghost ghost added this to the 8.0.x milestone Dec 12, 2023
@ghost
Copy link

ghost commented Dec 12, 2023

Hi @surayya-MS. If this is not a tell-mode PR, please make sure to follow the instructions laid out in the servicing process document.
Otherwise, please add tell-mode label.

@ghost
Copy link

ghost commented Dec 12, 2023

Hi @surayya-MS. Please make sure you've updated the PR description to use the Shiproom Template. Also, make sure this PR is not marked as a draft and is ready-to-merge.

To learn more about how to prepare a servicing PR click here.

@mkArtakMSFT mkArtakMSFT added Servicing-approved Shiproom has approved the issue and removed Servicing-consider Shiproom approval is required for the issue labels Dec 12, 2023
@ghost
Copy link

ghost commented Dec 12, 2023

Hi @surayya-MS. This PR was just approved to be included in the upcoming servicing release. Somebody from the @dotnet/aspnet-build team will get it merged when the branches are open. Until then, please make sure all the CI checks pass and the PR is reviewed.

Copy link
Contributor

@mkArtakMSFT mkArtakMSFT left a comment

Choose a reason for hiding this comment

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

Approved as this is a backport PR which was approved already.

@mkArtakMSFT mkArtakMSFT added * NO MERGE * Do not merge this PR as long as this label is present. and removed * NO MERGE * Do not merge this PR as long as this label is present. labels Dec 13, 2023
@ghost
Copy link

ghost commented Dec 21, 2023

Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime.
To make sure no conflicting changes have occurred, please rerun validation before merging. You can do this by leaving an /azp run comment here (requires commit rights), or by simply closing and reopening.

@ghost ghost added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Dec 21, 2023
@surayya-MS
Copy link
Member Author

surayya-MS commented Dec 21, 2023

This test fails Microsoft.AspNetCore.Components.E2ETest.Tests.EventTest.Cancel_CanTrigger.

I think it is a flaky test because I merged this same change to main branch 2 weeks ago #52559 and this test was passing. I then found out that this test was quarantined in main a week after #52785 . This test is not quarantined in release/8.0 branch.

cc @dotnet/aspnet-blazor-eng, @wtgodbe

@wtgodbe wtgodbe removed the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Jan 3, 2024
@wtgodbe
Copy link
Member

wtgodbe commented Jan 3, 2024

/azp run

@ghost ghost added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Jan 3, 2024
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@wtgodbe
Copy link
Member

wtgodbe commented Jan 4, 2024

@MackinnonBuck @mkArtakMSFT there's a merge conflict here, who can take a look at it now that Surayya is off the team?

@wtgodbe
Copy link
Member

wtgodbe commented Jan 9, 2024

/azp run

@wtgodbe wtgodbe enabled auto-merge (squash) January 9, 2024 20:41
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@MackinnonBuck
Copy link
Member

The test failures seem to be caused by EF migrations not being able to apply:

2024-01-09T22:55:20.8760092Z   Failed Templates.Mvc.Test.RazorPagesTemplateTest.RazorPagesTemplate_IndividualAuth(useProgramMain: True, noHttps: False) [7 s]
2024-01-09T22:55:20.8760123Z   Error Message:
2024-01-09T22:55:20.8761067Z    Project new razor  --auth Individual --use-program-main failed to run EF migrations. Exit code 150.
2024-01-09T22:55:20.8761127Z dotnet-ef --verbose --no-build migrations add razorpages\nStdErr: You must install or update .NET to run this application.

Not yet sure why this would suddenly start happening.

@wtgodbe
Copy link
Member

wtgodbe commented Jan 10, 2024

Test failures are unrelated

@wtgodbe wtgodbe disabled auto-merge January 10, 2024 19:21
@wtgodbe wtgodbe merged commit 19258e5 into dotnet:release/8.0 Jan 10, 2024
@ghost ghost modified the milestones: 8.0.x, 8.0.2 Jan 10, 2024
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 area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework Servicing-approved Shiproom has approved the issue
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants