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
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user