Skip to content

Commit

Permalink
use OnAfterRenderAsync to load entity instead of OnInitialized.
Browse files Browse the repository at this point in the history
Signed-off-by: David Hernando <[email protected]>
  • Loading branch information
davidatwhiletrue committed Jul 12, 2024
1 parent a335d4a commit cd6a2bd
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Docs/Demos/NCTLWebExplorer/Pages/GetEntity.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,17 @@ public partial class GetEntity

private string EntityAddress { get; set; }

protected override async Task OnInitializedAsync()
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (!string.IsNullOrWhiteSpace(AccountPublicKey))
if (firstRender && !string.IsNullOrWhiteSpace(AccountPublicKey))
{
EntityAddress = AccountPublicKey;
await GetEntityBtnClicked();
StateHasChanged();
}
await base.OnInitializedAsync();

await base.OnAfterRenderAsync(firstRender);
}

async Task GetEntityBtnClicked()
{
ErrorMessage = null;
Expand Down

0 comments on commit cd6a2bd

Please sign in to comment.