diff --git a/scm-ui/ui-components/src/repos/DiffFile.tsx b/scm-ui/ui-components/src/repos/DiffFile.tsx index fe35cc111f..942d789f99 100644 --- a/scm-ui/ui-components/src/repos/DiffFile.tsx +++ b/scm-ui/ui-components/src/repos/DiffFile.tsx @@ -222,6 +222,14 @@ class DiffFile extends React.Component { return ; }; + concat = (array: object[][]) => { + if (array.length > 0) { + return array.reduce((a, b) => a.concat(b)); + } else { + return []; + } + }; + render() { const { file, fileControlFactory, fileAnnotationFactory, t } = this.props; const { collapsed, sideBySide } = this.state; @@ -236,7 +244,7 @@ class DiffFile extends React.Component {
{fileAnnotations} - {(hunks: HunkType[]) => hunks.map(this.renderHunk).reduce((a, b) => a.concat(b))} + {(hunks: HunkType[]) => this.concat(hunks.map(this.renderHunk))}
);