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 }