Improved the loading of some components that require data fetching (#512)

This commit is contained in:
Thorsten Sommer 2025-06-27 20:52:33 +02:00 committed by GitHub
parent 3587f547b5
commit 181ba07d2d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 29 additions and 18 deletions

View File

@ -47,14 +47,17 @@ public partial class Workspaces : MSGComponentBase
// - Those initial tree items cannot have children
// - When assigning the tree items to the MudTreeViewItem component, we must set the Value property to the value of the item
//
await this.LoadTreeItems();
// We won't await the loading of the tree items here,
// to avoid blocking the UI thread:
_ = this.LoadTreeItems();
}
#endregion
private async Task LoadTreeItems()
{
var workspacesNode = new TreeItemData<ITreeItem>
this.treeItems.Clear();
this.treeItems.Add(new TreeItemData<ITreeItem>
{
Expanded = this.ExpandRootNodes,
Expandable = true,
@ -68,9 +71,16 @@ public partial class Workspaces : MSGComponentBase
Path = "root",
Children = await this.LoadWorkspaces(),
},
};
var tempChatNode = new TreeItemData<ITreeItem>
});
this.treeItems.Add(new TreeItemData<ITreeItem>
{
Expandable = false,
Value = new TreeDivider(),
});
await this.InvokeAsync(this.StateHasChanged);
this.treeItems.Add(new TreeItemData<ITreeItem>
{
Expanded = this.ExpandRootNodes,
Expandable = true,
@ -84,16 +94,9 @@ public partial class Workspaces : MSGComponentBase
Path = "temp",
Children = await this.LoadTemporaryChats(),
},
};
this.treeItems.Clear();
this.treeItems.Add(workspacesNode);
this.treeItems.Add(new TreeItemData<ITreeItem>
{
Expandable = false,
Value = new TreeDivider(),
});
this.treeItems.Add(tempChatNode);
await this.InvokeAsync(this.StateHasChanged);
}
private async Task<IReadOnlyCollection<TreeItemData<ITreeItem>>> LoadTemporaryChats()

View File

@ -66,7 +66,10 @@ public partial class About : MSGComponentBase
this.logPaths = await this.RustService.GetLogPaths();
await base.OnInitializedAsync();
await this.DeterminePandocVersion();
// Determine the Pandoc version may take some time, so we start it here
// without waiting for the result:
_ = this.DeterminePandocVersion();
}
#endregion

View File

@ -19,10 +19,12 @@ public partial class Home : MSGComponentBase
protected override async Task OnInitializedAsync()
{
await this.ReadLastChangeAsync();
await base.OnInitializedAsync();
this.InitializeAdvantagesItems();
// Read the last change content asynchronously
// without blocking the UI thread:
_ = this.ReadLastChangeAsync();
}
private void InitializeAdvantagesItems()
@ -61,6 +63,8 @@ public partial class Home : MSGComponentBase
var latest = Changelog.LOGS.MaxBy(n => n.Build);
using var response = await this.HttpClient.GetAsync($"changelog/{latest.Filename}");
this.LastChangeContent = await response.Content.ReadAsStringAsync();
await this.InvokeAsync(this.StateHasChanged);
}
private const string QUICK_START_GUIDE =

View File

@ -32,7 +32,7 @@ public sealed class EnterpriseEnvironmentService(ILogger<EnterpriseEnvironmentSe
{
try
{
logger.LogInformation("Starting update of the enterprise environment.");
logger.LogInformation("Start updating of the enterprise environment.");
var enterpriseRemoveConfigId = await rustService.EnterpriseEnvRemoveConfigId();
var isPlugin2RemoveInUse = PluginFactory.AvailablePlugins.Any(plugin => plugin.Id == enterpriseRemoveConfigId);

View File

@ -1,5 +1,6 @@
# v0.9.49, build 224 (2025-06-xx xx:xx UTC)
- Added a library by Nils Kruthoff (`nilskruthoff`) that allows AI Studio to read PowerPoint files. This feature is not yet available in the UI, but it will soon be available. Thanks, Nils, for that great contribution.
- Improved the loading of some components that require data fetching, resulting in a more responsive UI.
- Changed the timestamp display to use the local datetime format for the chats and assistants.
- Upgraded to Rust 1.88.0.
- Upgraded MudBlazor to version 8.8.0.