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, error,
loading loading
} = useAsync(async () => { } = useAsync(async () => {
if (noteId === undefined || selectedRevisionId === undefined) { if (noteId && selectedRevisionId !== undefined) {
throw new Error('No revision selected')
} else {
return await getRevision(noteId, selectedRevisionId) return await getRevision(noteId, selectedRevisionId)
} }
}, [selectedRevisionId, noteId]) }, [selectedRevisionId, noteId])
@ -51,7 +49,7 @@ export const RevisionViewer: React.FC<RevisionViewerProps> = ({ selectedRevision
return applyPatch(revision.content, inversePatch) || '' return applyPatch(revision.content, inversePatch) || ''
}, [revision]) }, [revision])
if (selectedRevisionId === undefined) { if (!noteId || selectedRevisionId === undefined) {
return <Fragment /> return <Fragment />
} }