Load data a little later on game edit screen. Fix TagsInput sometimes losing data.

lx-work
Pat Hartl 2023-12-02 23:48:36 -06:00
parent 171f82df3e
commit 50eff6784f
2 changed files with 10 additions and 2 deletions

View File

@ -45,7 +45,7 @@
} }
if (ValuesChanged.HasDelegate) if (ValuesChanged.HasDelegate)
await ValuesChanged.InvokeAsync(); await ValuesChanged.InvokeAsync(Values);
StateHasChanged(); StateHasChanged();
} }

View File

@ -161,6 +161,7 @@ else
[Parameter] public Guid Id { get; set; } [Parameter] public Guid Id { get; set; }
[Parameter] public string Panel { get; set; } [Parameter] public string Panel { get; set; }
bool Loaded = false;
bool Success; bool Success;
string[] Errors = { }; string[] Errors = { };
@ -206,8 +207,13 @@ else
}); });
} } } }
protected override async Task OnInitializedAsync() protected override async Task OnParametersSetAsync()
{ {
if (!Loaded)
await LoadData();
}
private async Task LoadData() {
if (Id == Guid.Empty) if (Id == Guid.Empty)
Game = new Game(); Game = new Game();
else else
@ -223,6 +229,8 @@ else
Description = r.Description, Description = r.Description,
Key = r.Id.ToString() Key = r.Id.ToString()
}); });
Loaded = true;
} }
private async Task Save() private async Task Save()