From 30adb3c33fcc88b641f8ba6275578f1792efbfd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Jasi=C5=84ski?= Date: Mon, 8 Jun 2026 14:16:59 +0200 Subject: [PATCH] fix: catch JSDisconnectedException and ObjectDisposedException in MarkdownEditor DisposeAsync to prevent noisy circuit disconnect logs --- .../Components/MarkdownEditor.razor | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/NexusReader.UI.Shared/Components/MarkdownEditor.razor b/src/NexusReader.UI.Shared/Components/MarkdownEditor.razor index 550de4b..5d12ed5 100644 --- a/src/NexusReader.UI.Shared/Components/MarkdownEditor.razor +++ b/src/NexusReader.UI.Shared/Components/MarkdownEditor.razor @@ -116,10 +116,18 @@ await _module.DisposeAsync(); } } + catch (JSDisconnectedException) + { + // Fail silently during circuit disconnection + } + catch (ObjectDisposedException) + { + // Fail silently if JS runtime/module is already disposed + } catch (Exception ex) { - // Fail silently during page navigation/webview closures to avoid noisy logs - Console.WriteLine($"[MarkdownEditor] Error during JS cleanup: {ex.Message}"); + // Log other unexpected errors + Console.WriteLine($"[MarkdownEditor] Unexpected error during JS cleanup: {ex.Message}"); } finally {