From d36e568ed00b31083ba709712c157c07feb8c2db Mon Sep 17 00:00:00 2001 From: VooDisss Date: Mon, 23 Feb 2026 02:30:44 +0200 Subject: [PATCH] fix: Use legacy diff algorithm for better large file performance - Set diffAlgorithm to 'legacy' for Monaco DiffEditor - Add maxComputationTime of 10s to avoid UI freeze on huge files This addresses the issue where sessions with large JSON files (50k-100k+ lines) would cause the UI to freeze. The 'legacy' algorithm is faster than 'advanced' for large files, similar to VSCode's workaround for the same issue. See: https://github.com/microsoft/vscode/issues/184037 --- .../ui/src/components/file-viewer/monaco-diff-viewer.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/ui/src/components/file-viewer/monaco-diff-viewer.tsx b/packages/ui/src/components/file-viewer/monaco-diff-viewer.tsx index c6694f80..ace89d5f 100644 --- a/packages/ui/src/components/file-viewer/monaco-diff-viewer.tsx +++ b/packages/ui/src/components/file-viewer/monaco-diff-viewer.tsx @@ -61,6 +61,11 @@ export function MonacoDiffViewer(props: MonacoDiffViewerProps) { // Keep enough gutter space so unified diffs don't overlap `+`/`-` markers. lineNumbersMinChars: 4, lineDecorationsWidth: 12, + // Use legacy diff algorithm for better performance with large files + // See: https://github.com/microsoft/vscode/issues/184037 + diffAlgorithm: "legacy", + // Limit computation time to avoid freezing on large files + maxComputationTime: 10000, }) setReady(true)