Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

fix: remove 500 errors when pagenumber 0

Marc Seitzd8739542f6fc
diff --git a/lib/swr/use-document.ts b/lib/swr/use-document.ts
index 20d7657f..f2f30b60 100644
--- a/lib/swr/use-document.ts
+++ b/lib/swr/use-document.ts
@@ -124,6 +124,13 @@ export function useDocumentProcessingStatus(documentVersionId: string) {
}
export function useDocumentThumbnail(pageNumber: number, documentId: string) {
+ if (pageNumber === 0) {
+ return {
+ data: null,
+ loading: false,
+ error: null,
+ };
+ }
const { data, error } = useSWR<{ imageUrl: string }>(
`/api/jobs/get-thumbnail?documentId=${documentId}&pageNumber=${pageNumber}`,
fetcher,