From f6cfe74d8cbb1fa7fa9e0738d423627fd64513b4 Mon Sep 17 00:00:00 2001 From: Erik Michelson Date: Sun, 22 Oct 2023 21:52:05 +0200 Subject: [PATCH] fix(frontend): error in review viewer Signed-off-by: Philip Molares Signed-off-by: Erik Michelson --- .../revisions-modal/revision-viewer.tsx | 6 ++---- 1 file changed, 2 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 d4f13ba44..e314f8505 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 @@ -32,9 +32,7 @@ export const RevisionViewer: React.FC = ({ selectedRevision error, loading } = useAsync(async () => { - if (noteId === undefined || selectedRevisionId === undefined) { - throw new Error('No revision selected') - } else { + if (noteId && selectedRevisionId !== undefined) { return await getRevision(noteId, selectedRevisionId) } }, [selectedRevisionId, noteId]) @@ -51,7 +49,7 @@ export const RevisionViewer: React.FC = ({ selectedRevision return applyPatch(revision.content, inversePatch) || '' }, [revision]) - if (selectedRevisionId === undefined) { + if (!noteId || selectedRevisionId === undefined) { return }