fix(frontend): fix type mismatch in revision-viewer.tsx

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2023-09-24 10:44:15 +02:00 committed by renovate[bot]
parent 41fb6f9e2e
commit a1a09f07d0

View file

@ -43,10 +43,12 @@ export const RevisionViewer: React.FC<RevisionViewerProps> = ({ selectedRevision
if (revision === undefined) { if (revision === undefined) {
return '' return ''
} }
const patch = parsePatch(revision.patch)[0] const patches = parsePatch(revision.patch)
const inversePatch = invertUnifiedPatch(patch) if (patches.length === 0) {
const reverseContent = applyPatch(revision.content, inversePatch) return ''
return reverseContent === false ? '' : reverseContent }
const inversePatch = invertUnifiedPatch(patches[0])
return applyPatch(revision.content, inversePatch)
}, [revision]) }, [revision])
if (selectedRevisionId === undefined) { if (selectedRevisionId === undefined) {