Fixed tree item loading when ensuring bias workspace

This commit is contained in:
Thorsten Sommer 2024-10-27 20:20:37 +01:00
parent ce7029f019
commit 00a935b7cf
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -64,8 +64,8 @@ public partial class Workspaces : ComponentBase
// - 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.EnsureBiasWorkspace();
await this.LoadTreeItems();
await base.OnInitializedAsync();
}
@ -252,7 +252,7 @@ public partial class Workspaces : ComponentBase
return result;
}
public async Task StoreChat(ChatThread chat)
public async Task StoreChat(ChatThread chat, bool reloadTreeItems = true)
{
string chatDirectory;
if (chat.WorkspaceId == Guid.Empty)
@ -272,7 +272,9 @@ public partial class Workspaces : ComponentBase
await File.WriteAllTextAsync(chatPath, JsonSerializer.Serialize(chat, JSON_OPTIONS), Encoding.UTF8);
// Reload the tree items:
if(reloadTreeItems)
await this.LoadTreeItems();
this.StateHasChanged();
}
@ -456,7 +458,6 @@ public partial class Workspaces : ComponentBase
Directory.CreateDirectory(workspacePath);
var workspaceNamePath = Path.Join(workspacePath, "name");
await File.WriteAllTextAsync(workspaceNamePath, "Bias of the Day", Encoding.UTF8);
await this.LoadTreeItems();
}
private async Task DeleteWorkspace(string? workspacePath)