fix(ui): address code review findings

- Fix event handler leak in TaskDetailView.OnDataContextChanged
  (unsubscribe from previous ViewModel before subscribing to new one)
- Move FormatFile call off UI thread with Task.Run to prevent freeze
  on large log files

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Mika Kuns
2026-04-14 16:47:46 +02:00
parent f8be2c178b
commit 7363e48496
2 changed files with 8 additions and 5 deletions

View File

@@ -90,7 +90,7 @@ public partial class TaskDetailViewModel : ViewModelBase
&& File.Exists(task.LogPath))
{
_formatter = new StreamLineFormatter();
LiveText = _formatter.FormatFile(task.LogPath);
LiveText = await Task.Run(() => _formatter.FormatFile(task.LogPath));
}
StatusText = task.Status.ToString().ToLowerInvariant();
StatusChoice = task.Status.ToString();