Skip to content

[release/8.0] [Blazor] Defer enhanced component updates until reconnection circuit completes #51242

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 6 commits into from
Oct 10, 2023

Conversation

MackinnonBuck
Copy link
Member

@MackinnonBuck MackinnonBuck commented Oct 9, 2023

Defer enhanced component updates until reconnection circuit completes

Ensures that enhanced updates to interactive server components get deferred until the circuit is reconnected.

Description

This PR includes two changes:

  1. Takes circuit "connected-ness" into account when determining if enhanced component updates can be applied
  2. Waits until any given root component's disposal gets acknowledged by .NET before the browser stops tracking it for SSR updates

Fixes #51082

Customer Impact

This change impacts Blazor Web scenarios where interactive server components exist on the page.

With this fix, it's more likely that a customer with an unstable connection will be able to continue using the app without refreshing the page. In particular:

  1. If a developer creates a custom, less intrusive reconnection dialog that allows the user to keep interacting with the app, a user-induced page navigation during reconnection won't bring the app to an unusable state
  2. If the user quickly navigates between pages while the circuit is unstable, there won't be console errors caused by attempting to interactively update a component that was removed from the page

Regression?

  • Yes
  • No

These fixes only affect "Blazor Web" scenarios, which are new in .NET 8.

Risk

  • High
  • Medium
  • Low

This is a moderately-sized change. However, we have existing automated tests that verify the scenarios that this code is likely to impact, and we've added new tests to help ensure that these fixes introduce the above stability improvements.

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

@MackinnonBuck MackinnonBuck added the area-blazor Includes: Blazor, Razor Components label Oct 9, 2023
@MackinnonBuck MackinnonBuck requested a review from a team as a code owner October 9, 2023 22:01
@mkArtakMSFT mkArtakMSFT added the Servicing-consider Shiproom approval is required for the issue label Oct 9, 2023
@ghost
Copy link

ghost commented Oct 9, 2023

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

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.

I think I understand the main ideas here and it seems reasonable to me.

It still seems as if state could be left hanging in edge cases (e.g., if the EndUpdateRootComponents message gets dropped, the client may think a root still exists but the server does not) but since that's only used for client-side cleanup that's not catastrophic.

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

ghost commented Oct 10, 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.

@MackinnonBuck
Copy link
Member Author

It still seems as if state could be left hanging in edge cases (e.g., if the EndUpdateRootComponents message gets dropped, the client may think a root still exists but the server does not) but since that's only used for client-side cleanup that's not catastrophic.

Yep, this is definitely something that can happen. In the future, we could consider a mechanism to detect if the circuit disconnects while a set of root component operations are being applied and somehow react to that.

@mkArtakMSFT mkArtakMSFT merged commit c8115ed into release/8.0 Oct 10, 2023
@mkArtakMSFT mkArtakMSFT deleted the mbuck/server-enhanced-update-fix branch October 10, 2023 23:38
@ghost ghost added this to the 8.0.0 milestone Oct 10, 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 Servicing-approved Shiproom has approved the issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants