From b9f1b5a51ec9ba4a272961191a5960839a64a77a Mon Sep 17 00:00:00 2001 From: AoshiW Date: Thu, 18 Dec 2025 00:09:48 +0100 Subject: [PATCH] fix Oopsies Dialog Spam --- .../Pages/Websocket/WebsocketViewModel.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Needlework.Net/ViewModels/Pages/Websocket/WebsocketViewModel.cs b/Needlework.Net/ViewModels/Pages/Websocket/WebsocketViewModel.cs index 8e091b7..7d2ffcc 100644 --- a/Needlework.Net/ViewModels/Pages/Websocket/WebsocketViewModel.cs +++ b/Needlework.Net/ViewModels/Pages/Websocket/WebsocketViewModel.cs @@ -29,6 +29,8 @@ public partial class WebSocketViewModel : PageBase, IEnableLogger { private Dictionary _events = []; + private readonly AvaloniaList _filteredEventLog = new(); + private readonly IFlurlClient _githubUserContentClient; private readonly NotificationService _notificationService; @@ -53,7 +55,20 @@ public partial class WebSocketViewModel : PageBase, IEnableLogger public CancellationTokenSource TokenSource { get; set; } = new(); - public IReadOnlyList FilteredEventLog => string.IsNullOrWhiteSpace(Search) ? EventLog : [.. EventLog.Where(x => x.Key.Contains(Search, StringComparison.InvariantCultureIgnoreCase))]; + public IReadOnlyList FilteredEventLog + { + get + { + IEnumerable events = EventLog; + if (!string.IsNullOrWhiteSpace(Search)) + { + events = events.Where(x => x.Key.Contains(Search, StringComparison.InvariantCultureIgnoreCase)); + } + _filteredEventLog.Clear(); + _filteredEventLog.AddRange(events); + return _filteredEventLog; + } + } [ObservableProperty] private Vector _eventLogOffset = new();