Skip to content

Commit e3aedcd

Browse files
committed
Updates
1 parent 29984d0 commit e3aedcd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

aspnetcore/blazor/components/lifecycle.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,9 @@ Add the [`[StreamRendering]` attribute](xref:Microsoft.AspNetCore.Components.Str
606606
@attribute [StreamRendering]
607607
```
608608

609-
When the `Home` component is prerendering, the `Slow` component is quickly rendered with its loading message. The `Home` component doesn't wait for ten seconds for the `Slow` component to finish rendering. However, the finished message displayed at the end of prerendering is replaced by the loading message while the component finally renders, which is another ten-second delay. In the case of a component that's accessing a real service, such as a database, the service call (or query for a database) re-executes a second time as well, which creates undesirable load on the app's service (or database). To address this, persist the prerendered state with <xref:Microsoft.AspNetCore.Components.PersistentComponentState> for final rendering of the component, as seen in the following updates to the `Slow` component:
609+
When the `Home` component is prerendering, the `Slow` component is quickly rendered with its loading message. The `Home` component doesn't wait for ten seconds for the `Slow` component to finish rendering. However, the finished message displayed at the end of prerendering is replaced by the loading message while the component finally renders, which is another ten-second delay. This occurs because `LoadDataAsync` is executing twice. When a component is accessing a real service, such as a database, the service call (or query for a database) re-executes a second time as well, which creates undesirable load on the app's service (or database).
610+
611+
To address the double rendering of the loading message and the re-execution of service and database calls, persist the prerendered state with <xref:Microsoft.AspNetCore.Components.PersistentComponentState> for final rendering of the component, as seen in the following updates to the `Slow` component:
610612

611613
```razor
612614
@page "/slow"

0 commit comments

Comments
 (0)