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

[release/8.0-rc1] [Blazor] Add APIs for "enhanced refresh" #50124

Merged
merged 3 commits into from
Aug 17, 2023

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Aug 16, 2023

Backport of #50068 to release/8.0-rc1

/cc @MackinnonBuck

[Blazor] Add APIs for "enhanced refresh"

Adds NavigationManager.Refresh(bool forceReload = false). This allows developers to refresh statically rendered content by forcing an SSR update.

Description

If forceReload is true, a full page reload will always be performed. Otherwise, the response HTML may be merged with the document's existing HTML to preserve client-side state, falling back on a full page reload if necessary.

Fixes #49414

Customer Impact

Unlike Blazor Server or WebAssembly components, statically rendered Blazor components don't update their content after being added to the page. However, the developer might want to manually trigger a refresh of static page content without performing a full page reload, which would destroy all client-side state.

An example of when this is useful might be if the user's authentication state changes, so the statically rendered layout needs to updated accordingly.

The alternative to using this method would be to call NavigationManager.NavigateTo(NavigationManager.Uri, replace: true). However, this has its downsides:

  • It's a lot to write for what we anticipate to be a fairly common operation
  • Static content won't get updated if client-side routing is used

The new Refresh method overcomes both these downsides.

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

This is an additive feature and won't affect existing app functionality.

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

@github-actions github-actions bot requested a review from a team as a code owner August 16, 2023 21:02
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Aug 16, 2023
@MackinnonBuck
Copy link
Member

@danmoseley Would you please take a look at this? It's a new Blazor API we're trying to bring into RC1. Thanks 🙂

@danmoseley danmoseley added the Servicing-approved Shiproom has approved the issue label Aug 16, 2023
@ghost
Copy link

ghost commented Aug 16, 2023

Hi @github-actions[bot]. 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.

@danmoseley
Copy link
Member

Looks good. Go ahead

@wtgodbe wtgodbe merged commit 35127bf into release/8.0-rc1 Aug 17, 2023
@wtgodbe wtgodbe deleted the backport/pr-50068-to-release/8.0-rc1 branch August 17, 2023 17:32
@ghost ghost added this to the 8.0-rc1 milestone Aug 17, 2023
@ghost ghost added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Aug 17, 2023
wtgodbe pushed a commit that referenced this pull request Aug 17, 2023
* Update dependencies from https://github.com/dotnet/arcade build 20230815.4 (#50113)

Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.RemoteExecutor
 From Version 8.0.0-beta.23411.1 -> To Version 8.0.0-beta.23415.4

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>

* [release/8.0-rc1] [Blazor] Add APIs for "enhanced refresh" (#50124)

* Add NavigationManager.Refresh() + tests

* PR feedback

* Add `forceReload` parameter

---------

Co-authored-by: Mackinnon Buck <mackinnon.buck@gmail.com>

* Support resolving keyed services from DI in RDF and RDG (#50095)

* Support resolving keyed services from DI in RDF and RDG

* Address feedback from peer review

* Support keyed services with different keys but same arg name

---------

Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Mackinnon Buck <mackinnon.buck@gmail.com>
Co-authored-by: Safia Abdalla <safia@microsoft.com>
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
None yet
Development

Successfully merging this pull request may close these issues.

3 participants