Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

Keep a thumbnail that has already been generated (#7953)

Reece Browne70ed362af61b
diff --git a/frontend/editor/src/core/hooks/useLazyThumbnail.ts b/frontend/editor/src/core/hooks/useLazyThumbnail.ts
index 8b8511a925..82e15ceca2 100644
--- a/frontend/editor/src/core/hooks/useLazyThumbnail.ts
+++ b/frontend/editor/src/core/hooks/useLazyThumbnail.ts
@@ -91,8 +91,8 @@ export function useLazyThumbnail(
const file = await indexedDB.loadFile(fileId);
if (!file || cancelled) return;
const thumbnail = await generateThumbnailForFile(file);
- if (cancelled || !thumbnail) return;
- setThumb(thumbnail);
+ if (!thumbnail) return;
+ if (!cancelled) setThumb(thumbnail);
void indexedDB.updateThumbnail(fileId, thumbnail);
queueStubThumbUpdate(fileId, thumbnail, (id, url) =>
updateStirlingFileStub(id, { thumbnailUrl: url }),