From 989fb052103a1f5d1df2a4609dca1f775c52374d Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Sun, 27 Apr 2025 12:26:03 +0200 Subject: [PATCH] Fixed order of initialization --- .../Assistants/AssistantBase.razor.cs | 3 ++- .../Components/Workspaces.razor.cs | 18 +++++++++++++++++- .../Dialogs/Settings/SettingsDialogBase.cs | 3 ++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/app/MindWork AI Studio/Assistants/AssistantBase.razor.cs b/app/MindWork AI Studio/Assistants/AssistantBase.razor.cs index 07938468..7abc5824 100644 --- a/app/MindWork AI Studio/Assistants/AssistantBase.razor.cs +++ b/app/MindWork AI Studio/Assistants/AssistantBase.razor.cs @@ -103,6 +103,8 @@ public abstract partial class AssistantBase : AssistantLowerBase wher protected override async Task OnInitializedAsync() { + await base.OnInitializedAsync(); + this.formChangeTimer.AutoReset = false; this.formChangeTimer.Elapsed += async (_, _) => { @@ -113,7 +115,6 @@ public abstract partial class AssistantBase : AssistantLowerBase wher this.MightPreselectValues(); this.providerSettings = this.SettingsManager.GetPreselectedProvider(this.Component); this.currentProfile = this.SettingsManager.GetPreselectedProfile(this.Component); - await base.OnInitializedAsync(); } protected override async Task OnParametersSetAsync() diff --git a/app/MindWork AI Studio/Components/Workspaces.razor.cs b/app/MindWork AI Studio/Components/Workspaces.razor.cs index bcf95425..59e43144 100644 --- a/app/MindWork AI Studio/Components/Workspaces.razor.cs +++ b/app/MindWork AI Studio/Components/Workspaces.razor.cs @@ -39,6 +39,8 @@ public partial class Workspaces : MSGComponentBase 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: // - 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 // await this.LoadTreeItems(); - await base.OnInitializedAsync(); } #endregion @@ -504,4 +505,19 @@ public partial class Workspaces : MSGComponentBase await this.LoadChat(chatPath, switchToChat: true); await this.LoadTreeItems(); } + + #region Overrides of MSGComponentBase + + protected override async Task ProcessIncomingMessage(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 } \ No newline at end of file diff --git a/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogBase.cs b/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogBase.cs index 7fa14518..a559179e 100644 --- a/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogBase.cs +++ b/app/MindWork AI Studio/Dialogs/Settings/SettingsDialogBase.cs @@ -27,11 +27,12 @@ public abstract class SettingsDialogBase : MSGComponentBase /// protected override async Task OnInitializedAsync() { + await base.OnInitializedAsync(); + this.ApplyFilters([], [ Event.CONFIGURATION_CHANGED ]); this.UpdateProviders(); this.UpdateEmbeddingProviders(); - await base.OnInitializedAsync(); } #endregion