[HOLD, Pre6] Rename 'Platform' to 'RendererInfo' (#32997)

pull/33023/head
Luke Latham 2024-07-09 13:04:14 -04:00 committed by GitHub
parent 66a3bfd74b
commit ca6772036d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 14 deletions

View File

@ -217,25 +217,19 @@ Additional information on render mode propagation is provided in the [Render mod
## Detect rendering location, interactivity, and assigned render mode at runtime
<!-- UPDATE 9.0 Renaming of API for Pre6:
Update the content and remove the NOTE -->
The `ComponentBase.RendererInfo` and `ComponentBase.AssignedRenderMode` properties permit the app to detect details about the location, interactivity, and assigned render mode of a component:
The `ComponentBase.Platform` and `ComponentBase.AssignedRenderMode` properties permit the app to detect details about the location, interactivity, and assigned render mode of a component:
* `Platform.Name` returns the location where the component is executing:
* `RendererInfo.Name` returns the location where the component is executing:
* `Static`: On the server (SSR) and incapable of interactivity.
* `Server`: On the server (SSR) and capable of interactivity after prerendering.
* `WebAssembly`: On the client (CSR) and capable of interactivity after prerendering.
* `WebView`: On the native device and capable of interactivity after prerendering.
* `Platform.IsInteractive` indicates if the component supports interactivity at the time of rendering. The value is `true` when rendering interactively or `false` when prerendering or for static SSR (`Platform.Name` of `Static`).
* `RendererInfo.IsInteractive` indicates if the component supports interactivity at the time of rendering. The value is `true` when rendering interactively or `false` when prerendering or for static SSR (`Platform.Name` of `Static`).
* `ComponentBase.AssignedRenderMode` exposes the component's assigned render mode:
* `InteractiveServer` for Interactive Server.
* `InteractiveAuto` for Interactive Auto.
* `InteractiveWebAssembly` for Interactive WebAssembly.
> [!NOTE]
> `ComponentBase.Platform` will be renamed to `ComponentBase.RendererInfo` in a future preview release.
Components use these properties to render content depending on their location or interactivity status. For example, a form can be disabled during prerendering and enabled when the component becomes interactive:
```razor
@ -258,7 +252,7 @@ Components use these properties to render content depending on their location or
{
Movie ??= await ...;
if (Platform.IsInteractive)
if (RendererInfo.IsInteractive)
{
disabled = false;
}

View File

@ -45,12 +45,8 @@ We've introduced a new API designed to simplify the process of querying componen
* **Check if the component is running in an interactive environment**: This can be helpful for components that have different behaviors based on the interactivity of their environment.
* **Retrieve the assigned render mode for the component**: Understanding the render mode can help in optimizing the rendering process and improving the overall performance of a component.
<!-- ACTIVATE THIS LINK AFTER https://github.com/dotnet/AspNetCore.Docs/pull/32794 merges
For more information, see <xref:blazor/components/render-modes?view=aspnetcore-9.0#detect-rendering-location-interactivity-and-assigned-render-mode-at-runtime>.
-->
### Improved server-side reconnection experience:
The following enhancements have been made to the default server-side reconnection experience: