diff --git a/Components/Pages/Index.razor b/Components/Pages/Index.razor
index 81697fd..f71148b 100644
--- a/Components/Pages/Index.razor
+++ b/Components/Pages/Index.razor
@@ -197,8 +197,8 @@
@@ -337,11 +337,6 @@
StateHasChanged();
}
- public Index()
- {
- myHome = this; // Set the static reference to the current instance
- }
-
protected override async Task OnInitializedAsync()
{
await _logger.InfoAsync("Index component initialized.", $"{SiteId}");
@@ -359,42 +354,25 @@
private async void UpdateContent(string receivedSessionId, string content, MenuItem? menuItem)
{
- if (receivedSessionId == SessionId) // Only accept messages meant for this tab
+ if (receivedSessionId != SessionId) return;
+ try
{
-
HtmlContent.Clear();
HtmlContent.Append(content);
- //InvokeAsync(StateHasChanged); // Ensures UI updates dynamically
- await InvokeAsync(() =>
- {
- StateHasChanged();
- });
- //_scopedContentService.CurrentDOM = await jsRuntime.InvokeAsync("getDivContent", "currentContent");
+ await InvokeAsync(StateHasChanged);
}
+ catch (Exception ex) { await _logger.ErrorAsync("UpdateContent failed", ex.Message); }
}
- // private async void UpdateTextContentForVoice(string receivedSessionId, string content)
- // {
- // Console.WriteLine("UPDATETEXTCONTENT called");
- // if (receivedSessionId == SessionId) // Only accept messages meant for this tab
- // {
-
- // TextContent = content;
- // await ConvertTextToSpeech(content);
- // //_scopedContentService.CurrentDOM = await jsRuntime.InvokeAsync("getDivContent", "currentContent");
- // }
- // }
-
private async void UpdateFinished(string receivedSessionId)
{
- if (receivedSessionId == SessionId) // Only accept messages meant for this tab
+ if (receivedSessionId != SessionId) return;
+ try
{
- Console.WriteLine("Content update finished");
var result = await jsRuntime.InvokeAsync