Skip to content

[release/8.0-preview7] [Blazor] Improvements to the interaction between SSR and interactive rendering #49557

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 1 commit into from
Jul 21, 2023

Conversation

MackinnonBuck
Copy link
Member

Improvements to the interaction between SSR and interactive rendering

This PR improves how Blazor's new SSR feature blends with interactive component rendering.

Description

Before this PR, full-stack Blazor had multiple limitations when using server-side rendering (SSR) and interactive rendering (Blazor Server/WebAssembly components) in combination:

  • Interactive components could not be added after the initial page load
  • Enhanced navigation was disabled after the first interactive component was added
    • This meant that a full page reload would occur when the route changed, even for "internal" navigations

Note: From now on, I'm going to refer to updates to static content that don't involve a page reload as "SSR updates". This includes enhanced navigations and stream rendering updates.

This PR enhances the experience by:

  • Allowing interactive components to be added via SSR updates
  • Allowing enhanced navigations to occur even after interactive components exist
  • Persisting component instances across SSR updates
    • i.e., user-entered state does not get destroyed when an SSR update occurs
  • Enabling an interactive component's parameters to get changed by an SSR update
  • Correctly disposing interactive component instances when an SSR update removes them

In summary, these changes make the boundary between SSR and interactive rendering much more seamless than it was before.

Fixes #48763
Fixes #48764

Customer Impact

Medium/high. Many of the issues we've run into when doing internal app building are due to the aforementioned limitations. This is a change we're anticipating will greatly increase the capabilities of apps customers can build, so it's critical we get feedback about whether the behavior of this feature meets their needs.

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

This is a large change that touches some fairly fundamental parts of the framework. Existing automated tests help give us reasonable confidence that existing Blazor WebAssembly and Server applications (non-SSR'd) won't be affected by this change. However, the possibility of behavioral changes in certain edge cases is non-zero.
New automated tests validate the functionality of the enhancements this PR brings.

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

@MackinnonBuck MackinnonBuck added the area-blazor Includes: Blazor, Razor Components label Jul 20, 2023
@MackinnonBuck MackinnonBuck requested a review from a team as a code owner July 20, 2023 22:44
@mkArtakMSFT mkArtakMSFT added the Servicing-approved Shiproom has approved the issue label Jul 21, 2023
@ghost
Copy link

ghost commented Jul 21, 2023

Hi @MackinnonBuck. 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.

Approving given that the original PR was approved and this is a backport only.

@wtgodbe wtgodbe merged commit 1a96639 into release/8.0-preview7 Jul 21, 2023
@wtgodbe wtgodbe deleted the mbuck/backport-49238 branch July 21, 2023 15:25
@ghost ghost added this to the 8.0-preview7 milestone Jul 21, 2023
@ghost ghost added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Jul 21, 2023
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