-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[release/8.0] [Blazor] Close the circuit when all Blazor Server compo…
…nents are disposed (#50170) # [Blazor] Close the circuit when all Blazor Server components are disposed Allows a Blazor Server circuit to close when all root Blazor Server components get dynamically removed from the page. ## Description The overall approach I've taken is: 1. Define what it means for the circuit to be in use (`WebRootComponentManager.hasAnyExistingOrPendingServerComponents()`): * There are interactive Blazor Server components on the page, or... * The initialization of an interactive Blazor Server component has started, but hasn't completed yet, or... * There are SSR'd components on the page that haven't been initialized for interactivity yet (consider stream rendering, where we don't activate new components until the response completes), but they have either a "Server" or "Auto" render mode 2. Determine the cases where a circuit's "in use" status may have changed: * After a render batch is applied (see `attachCircuitAfterRenderCallback` in `WebRootComponentManager.ts`) * An applied render batch may result in the creation/disposal of a root component * After an SSR update occurs, but before the first render batch is applied * Consider the case where an SSR'd component with a Server render mode gets removed from the page, but before the circuit has a chance to initialize 3. Decide what to do if the "in use" status may have changed (`WebRootComponentManager.circuitMayHaveNoRootComponents()`): * If the circuit is not in use: * Start a timeout with some configurable duration (`SsrStartOptions.circuitInactivityTimeoutMs`), if it hasn't started already * When the timeout expires, dispose the circuit * If the circuit is not in use: * Clear any existing timeout This PR also: - [X] Addresses a bug preventing Virtualize from working correctly when a WebAssembly and Server instance is present on the page at the same time - [X] Adds E2E tests Fixes #48765
- Loading branch information
1 parent
9781991
commit 8a50cd5
Showing
26 changed files
with
810 additions
and
332 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.