fix(frontend): error in review viewer

Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
Erik Michelson 2023-10-22 21:52:05 +02:00 committed by Philip Molares
parent ee5b54c7b6
commit f6cfe74d8c

View file

@ -32,9 +32,7 @@ export const RevisionViewer: React.FC<RevisionViewerProps> = ({ 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<RevisionViewerProps> = ({ selectedRevision
return applyPatch(revision.content, inversePatch) || ''
}, [revision])
if (selectedRevisionId === undefined) {
if (!noteId || selectedRevisionId === undefined) {
return <Fragment />
}