From 6a93d861fa8cc5906a564a88ae79c21c85985e14 Mon Sep 17 00:00:00 2001 From: Florian Scholdei Date: Wed, 21 Oct 2020 10:50:14 +0200 Subject: [PATCH] Fix empty content in modal view of collapsed panel --- scm-ui/ui-components/src/repos/DiffFile.tsx | 31 +++++++++++---------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/scm-ui/ui-components/src/repos/DiffFile.tsx b/scm-ui/ui-components/src/repos/DiffFile.tsx index c977e228a4..e98d6fc39f 100644 --- a/scm-ui/ui-components/src/repos/DiffFile.tsx +++ b/scm-ui/ui-components/src/repos/DiffFile.tsx @@ -415,30 +415,31 @@ class DiffFile extends React.Component { const { file, collapsed, sideBySide, diffExpander, expansionError } = this.state; const viewType = sideBySide ? "split" : "unified"; - let body = null; + const fileAnnotations = fileAnnotationFactory ? fileAnnotationFactory(file) : null; + const innerContent = ( +
+ {fileAnnotations} + + {(hunks: HunkType[]) => + hunks?.map((hunk, n) => { + return this.renderHunk(file, diffExpander.getHunk(n), n); + }) + } + +
+ ); let icon = "angle-right"; + let body = null; if (!collapsed) { - const fileAnnotations = fileAnnotationFactory ? fileAnnotationFactory(file) : null; icon = "angle-down"; - body = ( -
- {fileAnnotations} - - {(hunks: HunkType[]) => - hunks?.map((hunk, n) => { - return this.renderHunk(file, diffExpander.getHunk(n), n); - }) - } - -
- ); + body = innerContent; } const collapseIcon = this.hasContent(file) ? : null; const fileControls = fileControlFactory ? fileControlFactory(file, this.setCollapse) : null; const openInFullscreen = file?.hunks?.length ? ( {body}} + modalBody={{innerContent}} /> ) : null; const sideBySideToggle = file?.hunks?.length && (