Rename OnInit and OnInitAsync to long form
OnInit -> OnInitialized OnInitAsync -> OnInitializedAsync
This commit is contained in:
parent
3c0fb1a3f8
commit
9287301208
|
|
@ -38,7 +38,7 @@ else
|
|||
@code {
|
||||
WeatherForecast[] forecasts;
|
||||
|
||||
protected override async Task OnInitAsync()
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
forecasts = await Http.GetJsonAsync<WeatherForecast[]>("weatherforecast");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ else
|
|||
@code {
|
||||
WeatherForecast[] forecasts;
|
||||
|
||||
protected override async Task OnInitAsync()
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
forecasts = await Http.GetJsonAsync<WeatherForecast[]>("sample-data/weather.json");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
string largeOrgChartJson;
|
||||
int numPeopleDeserialized;
|
||||
|
||||
protected override void OnInit()
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
smallOrgChartJson = JsonSerializer.Serialize(smallOrgChart);
|
||||
largeOrgChartJson = JsonSerializer.Serialize(largeOrgChart);
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ namespace Microsoft.AspNetCore.Components
|
|||
[Microsoft.AspNetCore.Components.ParameterAttribute]
|
||||
public Microsoft.AspNetCore.Components.RenderFragment ChildContent { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } private set { throw null; } }
|
||||
protected override void BuildRenderTree(Microsoft.AspNetCore.Components.RenderTree.RenderTreeBuilder builder) { }
|
||||
protected override void OnInit() { }
|
||||
protected override void OnInitialized() { }
|
||||
void System.IDisposable.Dispose() { }
|
||||
}
|
||||
|
||||
|
|
@ -124,7 +124,7 @@ namespace Microsoft.AspNetCore.Components.Forms
|
|||
public partial class DataAnnotationsValidator : Microsoft.AspNetCore.Components.ComponentBase
|
||||
{
|
||||
public DataAnnotationsValidator() { }
|
||||
protected override void OnInit() { }
|
||||
protected override void OnInitialized() { }
|
||||
}
|
||||
|
||||
public partial class EditForm : Microsoft.AspNetCore.Components.ComponentBase
|
||||
|
|
|
|||
|
|
@ -88,8 +88,8 @@ namespace Microsoft.AspNetCore.Components
|
|||
System.Threading.Tasks.Task Microsoft.AspNetCore.Components.IHandleEvent.HandleEventAsync(Microsoft.AspNetCore.Components.EventCallbackWorkItem callback, object arg) { throw null; }
|
||||
protected virtual void OnAfterRender() { }
|
||||
protected virtual System.Threading.Tasks.Task OnAfterRenderAsync() { throw null; }
|
||||
protected virtual void OnInit() { }
|
||||
protected virtual System.Threading.Tasks.Task OnInitAsync() { throw null; }
|
||||
protected virtual void OnInitialized() { }
|
||||
protected virtual System.Threading.Tasks.Task OnInitializedAsync() { throw null; }
|
||||
protected virtual void OnParametersSet() { }
|
||||
protected virtual System.Threading.Tasks.Task OnParametersSetAsync() { throw null; }
|
||||
public virtual System.Threading.Tasks.Task SetParametersAsync(Microsoft.AspNetCore.Components.ParameterCollection parameters) { throw null; }
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
/// </summary>
|
||||
[Parameter] public RenderFragment ChildContent { get; private set; }
|
||||
|
||||
protected override void OnInit()
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
AuthenticationStateProvider.AuthenticationStateChanged += OnAuthenticationStateChanged;
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ namespace Microsoft.AspNetCore.Components
|
|||
/// Method invoked when the component is ready to start, having received its
|
||||
/// initial parameters from its parent in the render tree.
|
||||
/// </summary>
|
||||
protected virtual void OnInit()
|
||||
protected virtual void OnInitialized()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ namespace Microsoft.AspNetCore.Components
|
|||
/// want the component to refresh when that operation is completed.
|
||||
/// </summary>
|
||||
/// <returns>A <see cref="Task"/> representing any asynchronous operation.</returns>
|
||||
protected virtual Task OnInitAsync()
|
||||
protected virtual Task OnInitializedAsync()
|
||||
=> Task.CompletedTask;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -192,8 +192,8 @@ namespace Microsoft.AspNetCore.Components
|
|||
|
||||
private async Task RunInitAndSetParametersAsync()
|
||||
{
|
||||
OnInit();
|
||||
var task = OnInitAsync();
|
||||
OnInitialized();
|
||||
var task = OnInitializedAsync();
|
||||
|
||||
if (task.Status != TaskStatus.RanToCompletion && task.Status != TaskStatus.Canceled)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Components.Forms
|
|||
[CascadingParameter] EditContext CurrentEditContext { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnInit()
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
if (CurrentEditContext == null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -402,21 +402,21 @@ namespace Microsoft.AspNetCore.Components.Test
|
|||
builder.CloseElement();
|
||||
}
|
||||
|
||||
protected override void OnInit()
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
if (RunsBaseOnInit)
|
||||
{
|
||||
base.OnInit();
|
||||
base.OnInitialized();
|
||||
}
|
||||
|
||||
OnInitLogic?.Invoke(this);
|
||||
}
|
||||
|
||||
protected override async Task OnInitAsync()
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (RunsBaseOnInitAsync)
|
||||
{
|
||||
await base.OnInitAsync();
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
if (OnInitAsyncLogic != null)
|
||||
|
|
|
|||
|
|
@ -3888,17 +3888,16 @@ namespace Microsoft.AspNetCore.Components.Test
|
|||
|
||||
[Parameter] public ConcurrentQueue<(int testId, EventType @event)> Log { get; set; }
|
||||
|
||||
protected override void OnInit()
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
if (TryGetEntry(EventType.OnInit, out var entry))
|
||||
{
|
||||
var result = entry.EventAction();
|
||||
LogResult(result.Result);
|
||||
}
|
||||
base.OnInit();
|
||||
}
|
||||
|
||||
protected override async Task OnInitAsync()
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (TryGetEntry(EventType.OnInitAsyncSync, out var entrySync))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
|
|||
public void RenderComponentAsync_CanRenderEmptyElement()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
|
||||
var expectedHtml = new[] { "<", "p", ">", "</", "p", ">" };
|
||||
var serviceProvider = new ServiceCollection().AddSingleton(new RenderFragment(rtb =>
|
||||
{
|
||||
|
|
@ -508,7 +508,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
|
|||
[Parameter] public bool Nested { get; set; }
|
||||
[Parameter] public int Value { get; set; }
|
||||
|
||||
protected override async Task OnInitAsync()
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
Value = Value * 2;
|
||||
await Task.Yield();
|
||||
|
|
@ -538,7 +538,7 @@ namespace Microsoft.AspNetCore.Components.Rendering
|
|||
[Parameter]
|
||||
public int Value { get; set; }
|
||||
|
||||
protected override async Task OnInitAsync()
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
Value = Value * 2;
|
||||
await Task.Delay(Value * 100);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<Links />
|
||||
|
||||
@code {
|
||||
protected override void OnInit()
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
// Start at AuthHome, not at any other component in the same app that happens to
|
||||
// register itself for the route ""
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
{
|
||||
protected bool isAfterDelay;
|
||||
|
||||
protected override async Task OnInitAsync()
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// If there are lots of instances of this component, the following delay
|
||||
// will result in a lot of them triggering a re-render simultaneously
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
EditContext editContext;
|
||||
string submissionStatus;
|
||||
|
||||
protected override void OnInit()
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
editContext = new EditContext(person).AddDataAnnotationsValidation();
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
KeyCasesTreeNode.Node parsedRootNode;
|
||||
RenderContext renderContext = new RenderContext();
|
||||
|
||||
protected override void OnInit()
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
Update();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
[Parameter] Node Data { get; set; }
|
||||
[CascadingParameter] KeyCasesComponent.RenderContext RenderContext { get; set; }
|
||||
|
||||
protected override void OnInit()
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
firstCreatedOnUpdateCount = RenderContext.UpdateCount;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,9 +8,8 @@
|
|||
@code{
|
||||
string UrlLocation;
|
||||
|
||||
protected override void OnInit()
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInit();
|
||||
UrlLocation = UriHelper.GetAbsoluteUri();
|
||||
UriHelper.OnLocationChanged += (_, __) =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
int tick;
|
||||
private bool _isDisposed;
|
||||
|
||||
protected override void OnInit()
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
Task.Run(() => InvokeAsync(async () =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
|
|||
|
||||
[Parameter] public bool Force { get; set; }
|
||||
|
||||
protected override void OnInit()
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
UriHelper.NavigateTo(RedirectUri, Force);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Test
|
|||
{
|
||||
RedirectUri = "http://localhost/redirect"
|
||||
}));
|
||||
|
||||
|
||||
Assert.Equal("A navigation command was attempted during prerendering after the server already started sending the response. " +
|
||||
"Navigation commands can not be issued during server-side prerendering after the response from the server has started. Applications must buffer the" +
|
||||
"reponse and avoid using features like FlushAsync() before all components on the page have been rendered to prevent failed navigation commands.",
|
||||
|
|
@ -274,7 +274,7 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures.Test
|
|||
|
||||
[Parameter] public bool Force { get; set; }
|
||||
|
||||
protected override void OnInit()
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
UriHelper.NavigateTo(RedirectUri, Force);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
@functions{
|
||||
|
||||
protected override void OnInit()
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
Helper.NavigateTo("/navigation-redirect");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
@* This is expected to throw and result in a 500 *@
|
||||
@code {
|
||||
protected override async Task OnInitAsync()
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await base.OnInitAsync();
|
||||
await base.OnInitializedAsync();
|
||||
throw new InvalidTimeZoneException("test");
|
||||
}
|
||||
}
|
||||
|
|
@ -38,7 +38,7 @@ else
|
|||
@code {
|
||||
WeatherForecast[] forecasts;
|
||||
|
||||
protected override async Task OnInitAsync()
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
forecasts = await ForecastService.GetForecastAsync(DateTime.Now);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
@code {
|
||||
bool canEditProfile;
|
||||
|
||||
protected override void OnInit()
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
var options = AzureADB2COptions.Get(AzureADB2CDefaults.AuthenticationScheme);
|
||||
canEditProfile = !string.IsNullOrEmpty(options.EditProfilePolicyId);
|
||||
|
|
|
|||
Loading…
Reference in New Issue