Fixed order of initialization

This commit is contained in:
Thorsten Sommer 2025-04-27 12:26:03 +02:00
parent 18aadebfff
commit 989fb05210
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
3 changed files with 21 additions and 3 deletions

View File

@ -103,6 +103,8 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
await base.OnInitializedAsync();
this.formChangeTimer.AutoReset = false; this.formChangeTimer.AutoReset = false;
this.formChangeTimer.Elapsed += async (_, _) => this.formChangeTimer.Elapsed += async (_, _) =>
{ {
@ -113,7 +115,6 @@ public abstract partial class AssistantBase<TSettings> : AssistantLowerBase wher
this.MightPreselectValues(); this.MightPreselectValues();
this.providerSettings = this.SettingsManager.GetPreselectedProvider(this.Component); this.providerSettings = this.SettingsManager.GetPreselectedProvider(this.Component);
this.currentProfile = this.SettingsManager.GetPreselectedProfile(this.Component); this.currentProfile = this.SettingsManager.GetPreselectedProfile(this.Component);
await base.OnInitializedAsync();
} }
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()

View File

@ -39,6 +39,8 @@ public partial class Workspaces : MSGComponentBase
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
await base.OnInitializedAsync();
// //
// Notice: In order to get the server-based loading to work, we need to respect the following rules: // Notice: In order to get the server-based loading to work, we need to respect the following rules:
// - We must have initial tree items // - We must have initial tree items
@ -46,7 +48,6 @@ public partial class Workspaces : MSGComponentBase
// - When assigning the tree items to the MudTreeViewItem component, we must set the Value property to the value of the item // - When assigning the tree items to the MudTreeViewItem component, we must set the Value property to the value of the item
// //
await this.LoadTreeItems(); await this.LoadTreeItems();
await base.OnInitializedAsync();
} }
#endregion #endregion
@ -504,4 +505,19 @@ public partial class Workspaces : MSGComponentBase
await this.LoadChat(chatPath, switchToChat: true); await this.LoadChat(chatPath, switchToChat: true);
await this.LoadTreeItems(); await this.LoadTreeItems();
} }
#region Overrides of MSGComponentBase
protected override async Task ProcessIncomingMessage<T>(ComponentBase? sendingComponent, Event triggeredEvent, T? data) where T : default
{
switch (triggeredEvent)
{
case Event.PLUGINS_RELOADED:
await this.LoadTreeItems();
await this.InvokeAsync(this.StateHasChanged);
break;
}
}
#endregion
} }

View File

@ -27,11 +27,12 @@ public abstract class SettingsDialogBase : MSGComponentBase
/// <inheritdoc /> /// <inheritdoc />
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
await base.OnInitializedAsync();
this.ApplyFilters([], [ Event.CONFIGURATION_CHANGED ]); this.ApplyFilters([], [ Event.CONFIGURATION_CHANGED ]);
this.UpdateProviders(); this.UpdateProviders();
this.UpdateEmbeddingProviders(); this.UpdateEmbeddingProviders();
await base.OnInitializedAsync();
} }
#endregion #endregion