react-diff-view
Advanced tools
Comparing version
{ | ||
"name": "react-diff-view", | ||
"version": "1.4.10", | ||
"version": "1.4.11", | ||
"description": "A git diff component to consume the git unified diff output.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -513,1 +513,5 @@ # react-diff-view | ||
- Fix a logic bug when split range of lines into valid ones. | ||
### 1.4.11 | ||
- Fix a bug where a stub hunk will crash the hunk insertion. |
@@ -327,3 +327,10 @@ import leven from 'leven'; | ||
const insertionOldLineNumber = computeOldLineNumber(insertion.changes[0]); | ||
const insertPosition = hunks.findIndex(hunk => computeOldLineNumber(hunk.changes[0]) >= insertionOldLineNumber); | ||
const isLaterThanInsertion = ({changes}) => { | ||
if (!changes.length) { | ||
return false; | ||
} | ||
return computeOldLineNumber(changes[0]) >= insertionOldLineNumber; | ||
}; | ||
const insertPosition = hunks.findIndex(isLaterThanInsertion); | ||
const hunksWithInsertion = insertPosition === -1 | ||
@@ -330,0 +337,0 @@ ? hunks.concat(insertion) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
706168
0.06%1723
0.35%517
0.78%