react-diff-viewer-continued icon indicating copy to clipboard operation
react-diff-viewer-continued copied to clipboard

Page crashes due to excessive single line text

Open HammerTWang opened this issue 9 months ago • 1 comments

The following two text files are examples: string-1.txt string-2.txt

  <ReactDiffViewer
    styles={{ contentText: { wordBreak: 'break-all' } }}
    oldValue={sourceValue || ''}
    newValue={targetValue || ''}
    showDiffOnly
    splitView
  />

After adding disableWordDiff, it can run normally. Is there a better solution

  <ReactDiffViewer
    styles={{ contentText: { wordBreak: 'break-all' } }}
    oldValue={sourceValue || ''}
    newValue={targetValue || ''}
    showDiffOnly
    splitView
    disableWordDiff
  />

HammerTWang avatar Mar 18 '25 02:03 HammerTWang

I don't think this thing was ever created to compare 50kb of pure noise on a single line. I think your issue comes from wordDiff trying to split changes on a single line as well, and doing that for 50kb of text is pretty intense (presumably the page crashes because the nested loop goes too deep)

Aeolun avatar May 12 '25 05:05 Aeolun