From d54e3b940d8e215d4604acb6a97dc8af2a491dac Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Mon, 21 Aug 2023 12:46:23 +0100 Subject: [PATCH] Make [StreamRendering] default to true --- src/Components/Components/src/PublicAPI.Unshipped.txt | 2 +- src/Components/Components/src/StreamRenderingAttribute.cs | 4 ++-- .../DoubleRenderingStreamingAsyncComponent.razor | 2 +- .../Endpoints/test/TestComponents/EnableStreaming.razor | 2 +- .../test/TestComponents/StreamingAsyncLoadingComponent.razor | 2 +- .../StreamingComponentThatRedirectsAsynchronously.razor | 2 +- .../StreamingComponentThatThrowsAsynchronously.razor | 2 +- .../test/TestComponents/StreamingComponentWithChild.razor | 2 +- .../RazorComponents/Components/EnableStreaming.razor | 2 +- .../Pages/EnhancedNav/PageForScrollingToHash.razor | 2 +- .../Pages/EnhancedNav/PageThatRedirectsWhileStreaming.razor | 2 +- .../Pages/EnhancedNav/PageThatThrowsWhileStreaming.razor | 2 +- .../Pages/Forms/ErrorInErrorBoundaryStreaming.razor | 2 +- .../Pages/Forms/ErrorOutsideErrorBoundaryStreaming.razor | 2 +- .../Pages/Forms/FormAntiforgeryAfterResponseStarted.razor | 2 +- .../RazorComponents/Pages/Forms/ModifyHttpContextForm.razor | 2 +- .../Pages/Forms/PostRedirectGetStreaming.razor | 2 +- .../RazorComponents/Pages/Forms/StreamingRenderingForm.razor | 2 +- .../Pages/StreamingRendering/LargeStreamRendering.razor | 2 +- .../Pages/StreamingRendering/StreamingRendering.razor | 2 +- .../Pages/StreamingRendering/StreamingWithInteractivity.razor | 2 +- 21 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/Components/Components/src/PublicAPI.Unshipped.txt b/src/Components/Components/src/PublicAPI.Unshipped.txt index bf4bf3f1c392..df77f9475253 100644 --- a/src/Components/Components/src/PublicAPI.Unshipped.txt +++ b/src/Components/Components/src/PublicAPI.Unshipped.txt @@ -80,7 +80,7 @@ Microsoft.AspNetCore.Components.Sections.SectionOutlet.SectionOutlet() -> void Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder.AddComponentParameter(int sequence, string! name, object? value) -> void Microsoft.AspNetCore.Components.StreamRenderingAttribute Microsoft.AspNetCore.Components.StreamRenderingAttribute.Enabled.get -> bool -Microsoft.AspNetCore.Components.StreamRenderingAttribute.StreamRenderingAttribute(bool enabled) -> void +Microsoft.AspNetCore.Components.StreamRenderingAttribute.StreamRenderingAttribute(bool enabled = true) -> void Microsoft.AspNetCore.Components.SupplyParameterFromQueryProviderServiceCollectionExtensions Microsoft.Extensions.DependencyInjection.CascadingValueServiceCollectionExtensions override Microsoft.AspNetCore.Components.EventCallback.GetHashCode() -> int diff --git a/src/Components/Components/src/StreamRenderingAttribute.cs b/src/Components/Components/src/StreamRenderingAttribute.cs index 6abe38053954..3b96783de037 100644 --- a/src/Components/Components/src/StreamRenderingAttribute.cs +++ b/src/Components/Components/src/StreamRenderingAttribute.cs @@ -18,8 +18,8 @@ public class StreamRenderingAttribute : Attribute /// /// Constructs an instance of /// - /// A flag to indicate whether this component and its descendants should stream their rendering. - public StreamRenderingAttribute(bool enabled) + /// A flag to indicate whether this component and its descendants should stream their rendering. The default value is true. + public StreamRenderingAttribute(bool enabled = true) { Enabled = enabled; } diff --git a/src/Components/Endpoints/test/TestComponents/DoubleRenderingStreamingAsyncComponent.razor b/src/Components/Endpoints/test/TestComponents/DoubleRenderingStreamingAsyncComponent.razor index 312b2fd1affb..69707f178136 100644 --- a/src/Components/Endpoints/test/TestComponents/DoubleRenderingStreamingAsyncComponent.razor +++ b/src/Components/Endpoints/test/TestComponents/DoubleRenderingStreamingAsyncComponent.razor @@ -1,4 +1,4 @@ -@attribute [StreamRendering(true)] +@attribute [StreamRendering] @if (loaded) { Loaded diff --git a/src/Components/Endpoints/test/TestComponents/EnableStreaming.razor b/src/Components/Endpoints/test/TestComponents/EnableStreaming.razor index 01697350947a..9c9db7524617 100644 --- a/src/Components/Endpoints/test/TestComponents/EnableStreaming.razor +++ b/src/Components/Endpoints/test/TestComponents/EnableStreaming.razor @@ -1,4 +1,4 @@ -@attribute [StreamRendering(true)] +@attribute [StreamRendering] @ChildContent @code { [Parameter] public RenderFragment ChildContent { get; set; } diff --git a/src/Components/Endpoints/test/TestComponents/StreamingAsyncLoadingComponent.razor b/src/Components/Endpoints/test/TestComponents/StreamingAsyncLoadingComponent.razor index adfcdb503a51..5eab5b418748 100644 --- a/src/Components/Endpoints/test/TestComponents/StreamingAsyncLoadingComponent.razor +++ b/src/Components/Endpoints/test/TestComponents/StreamingAsyncLoadingComponent.razor @@ -1,4 +1,4 @@ -@attribute [StreamRendering(true)] +@attribute [StreamRendering] Loading task status: @LoadingTask.Status @code { [Parameter] public Task LoadingTask { get; set; } diff --git a/src/Components/Endpoints/test/TestComponents/StreamingComponentThatRedirectsAsynchronously.razor b/src/Components/Endpoints/test/TestComponents/StreamingComponentThatRedirectsAsynchronously.razor index 8d1589c4f8bc..70227cdf3863 100644 --- a/src/Components/Endpoints/test/TestComponents/StreamingComponentThatRedirectsAsynchronously.razor +++ b/src/Components/Endpoints/test/TestComponents/StreamingComponentThatRedirectsAsynchronously.razor @@ -1,4 +1,4 @@ -@attribute [StreamRendering(true)] +@attribute [StreamRendering] @inject NavigationManager Nav Some output @code { diff --git a/src/Components/Endpoints/test/TestComponents/StreamingComponentThatThrowsAsynchronously.razor b/src/Components/Endpoints/test/TestComponents/StreamingComponentThatThrowsAsynchronously.razor index cd9a354f6c0c..bcfa39f5609a 100644 --- a/src/Components/Endpoints/test/TestComponents/StreamingComponentThatThrowsAsynchronously.razor +++ b/src/Components/Endpoints/test/TestComponents/StreamingComponentThatThrowsAsynchronously.razor @@ -1,4 +1,4 @@ -@attribute [StreamRendering(true)] +@attribute [StreamRendering] Some output @code { protected override async Task OnInitializedAsync() diff --git a/src/Components/Endpoints/test/TestComponents/StreamingComponentWithChild.razor b/src/Components/Endpoints/test/TestComponents/StreamingComponentWithChild.razor index 4afc4bc4907b..86b3b484fdd2 100644 --- a/src/Components/Endpoints/test/TestComponents/StreamingComponentWithChild.razor +++ b/src/Components/Endpoints/test/TestComponents/StreamingComponentWithChild.razor @@ -1,4 +1,4 @@ -@attribute [StreamRendering(true)] +@attribute [StreamRendering] [LoadingTask: @LoadingTask.Status] @code { diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Components/EnableStreaming.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Components/EnableStreaming.razor index 01697350947a..9c9db7524617 100644 --- a/src/Components/test/testassets/Components.TestServer/RazorComponents/Components/EnableStreaming.razor +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Components/EnableStreaming.razor @@ -1,4 +1,4 @@ -@attribute [StreamRendering(true)] +@attribute [StreamRendering] @ChildContent @code { [Parameter] public RenderFragment ChildContent { get; set; } diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/EnhancedNav/PageForScrollingToHash.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/EnhancedNav/PageForScrollingToHash.razor index bbb5583d0d92..b49d40f28e14 100644 --- a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/EnhancedNav/PageForScrollingToHash.razor +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/EnhancedNav/PageForScrollingToHash.razor @@ -1,5 +1,5 @@ @page "/nav/scroll-to-hash" -@attribute [StreamRendering(true)] +@attribute [StreamRendering] Page for scrolling to hash diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/EnhancedNav/PageThatRedirectsWhileStreaming.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/EnhancedNav/PageThatRedirectsWhileStreaming.razor index 8eb3151a0a96..e3069f1ec3ff 100644 --- a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/EnhancedNav/PageThatRedirectsWhileStreaming.razor +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/EnhancedNav/PageThatRedirectsWhileStreaming.razor @@ -1,5 +1,5 @@ @page "/nav/do-redirection-while-streaming" -@attribute [StreamRendering(true)] +@attribute [StreamRendering] @inject NavigationManager Nav

Please wait...

@code { diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/EnhancedNav/PageThatThrowsWhileStreaming.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/EnhancedNav/PageThatThrowsWhileStreaming.razor index 8c1463cdd86f..a1c41eb93d3f 100644 --- a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/EnhancedNav/PageThatThrowsWhileStreaming.razor +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/EnhancedNav/PageThatThrowsWhileStreaming.razor @@ -1,5 +1,5 @@ @page "/nav/throw-while-streaming" -@attribute [StreamRendering(true)] +@attribute [StreamRendering]

Please wait...

@code { protected override async Task OnInitializedAsync() diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Forms/ErrorInErrorBoundaryStreaming.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Forms/ErrorInErrorBoundaryStreaming.razor index 86f44f642cba..310f90eee55d 100644 --- a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Forms/ErrorInErrorBoundaryStreaming.razor +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Forms/ErrorInErrorBoundaryStreaming.razor @@ -1,5 +1,5 @@ @page "/forms/error-in-error-boundary-streaming" -@attribute [StreamRendering(true)] +@attribute [StreamRendering] @using Microsoft.AspNetCore.Components.Forms

Error in error boundary (streaming)

diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Forms/ErrorOutsideErrorBoundaryStreaming.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Forms/ErrorOutsideErrorBoundaryStreaming.razor index e479d3cc3ac3..624fb57af370 100644 --- a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Forms/ErrorOutsideErrorBoundaryStreaming.razor +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Forms/ErrorOutsideErrorBoundaryStreaming.razor @@ -1,5 +1,5 @@ @page "/forms/error-outside-error-boundary-streaming" -@attribute [StreamRendering(true)] +@attribute [StreamRendering] @using Microsoft.AspNetCore.Components.Forms

Error outside error boundary (streaming)

diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Forms/FormAntiforgeryAfterResponseStarted.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Forms/FormAntiforgeryAfterResponseStarted.razor index 3db8e94fd121..4f5efec24362 100644 --- a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Forms/FormAntiforgeryAfterResponseStarted.razor +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Forms/FormAntiforgeryAfterResponseStarted.razor @@ -1,5 +1,5 @@ @page "/forms/antiforgery-after-response-started" -@attribute [StreamRendering(true)] +@attribute [StreamRendering] @using Microsoft.AspNetCore.Components.Forms

Default form

diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Forms/ModifyHttpContextForm.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Forms/ModifyHttpContextForm.razor index 223d0674d3fd..5109303ae5d5 100644 --- a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Forms/ModifyHttpContextForm.razor +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Forms/ModifyHttpContextForm.razor @@ -1,5 +1,5 @@ @page "/forms/modify-http-context/{OperationId}" -@attribute [StreamRendering(true)] +@attribute [StreamRendering] @inject AsyncOperationService AsyncOperation @inject NavigationManager Navigation @* This is not the recommended way to access the HttpContext in Blazor, this is just for test purposes *@ diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Forms/PostRedirectGetStreaming.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Forms/PostRedirectGetStreaming.razor index de6448ec2069..f904c59fb337 100644 --- a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Forms/PostRedirectGetStreaming.razor +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Forms/PostRedirectGetStreaming.razor @@ -1,7 +1,7 @@ @page "/forms/post-redirect-get-streaming" @using Microsoft.AspNetCore.Components.Forms @inject NavigationManager Nav -@attribute [StreamRendering(true)] +@attribute [StreamRendering]

Post/Redirect/Get

diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Forms/StreamingRenderingForm.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Forms/StreamingRenderingForm.razor index bd90d62f44d9..465a3d0f5365 100644 --- a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Forms/StreamingRenderingForm.razor +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/Forms/StreamingRenderingForm.razor @@ -1,5 +1,5 @@ @page "/forms/streaming-rendering/{OperationId}" -@attribute [StreamRendering(true)] +@attribute [StreamRendering] @inject AsyncOperationService AsyncOperation @inject NavigationManager Navigation; @using Components.TestServer.Services; diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/StreamingRendering/LargeStreamRendering.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/StreamingRendering/LargeStreamRendering.razor index 5efe53a4512c..9b6d199c76ee 100644 --- a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/StreamingRendering/LargeStreamRendering.razor +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/StreamingRendering/LargeStreamRendering.razor @@ -1,6 +1,6 @@ @page "/large-streaming" -@attribute [StreamRendering(true)] +@attribute [StreamRendering]

Streaming Rendering

diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/StreamingRendering/StreamingRendering.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/StreamingRendering/StreamingRendering.razor index 8baaa0bd6acc..0bd36fd4817c 100644 --- a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/StreamingRendering/StreamingRendering.razor +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/StreamingRendering/StreamingRendering.razor @@ -1,6 +1,6 @@ @page "/streaming" -@attribute [StreamRendering(true)] +@attribute [StreamRendering]

Streaming Rendering

diff --git a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/StreamingRendering/StreamingWithInteractivity.razor b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/StreamingRendering/StreamingWithInteractivity.razor index 464998782a15..a7081d1068a6 100644 --- a/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/StreamingRendering/StreamingWithInteractivity.razor +++ b/src/Components/test/testassets/Components.TestServer/RazorComponents/Pages/StreamingRendering/StreamingWithInteractivity.razor @@ -1,6 +1,6 @@ @page "/streaming-interactivity" -@attribute [StreamRendering(true)] +@attribute [StreamRendering]

Streaming Rendering with Interactivity