From a1a09f07d02ad2186c40d91b43d9d4b8201cf105 Mon Sep 17 00:00:00 2001 From: Tilman Vatteroth Date: Sun, 24 Sep 2023 10:44:15 +0200 Subject: [PATCH] fix(frontend): fix type mismatch in revision-viewer.tsx Signed-off-by: Tilman Vatteroth --- .../revisions-modal/revision-viewer.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/revisions-sidebar-entry/revisions-modal/revision-viewer.tsx b/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/revisions-sidebar-entry/revisions-modal/revision-viewer.tsx index ae43db013..af5adfd28 100644 --- a/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/revisions-sidebar-entry/revisions-modal/revision-viewer.tsx +++ b/frontend/src/components/editor-page/sidebar/specific-sidebar-entries/revisions-sidebar-entry/revisions-modal/revision-viewer.tsx @@ -43,10 +43,12 @@ export const RevisionViewer: React.FC = ({ selectedRevision if (revision === undefined) { return '' } - const patch = parsePatch(revision.patch)[0] - const inversePatch = invertUnifiedPatch(patch) - const reverseContent = applyPatch(revision.content, inversePatch) - return reverseContent === false ? '' : reverseContent + const patches = parsePatch(revision.patch) + if (patches.length === 0) { + return '' + } + const inversePatch = invertUnifiedPatch(patches[0]) + return applyPatch(revision.content, inversePatch) }, [revision]) if (selectedRevisionId === undefined) {