From d4e66c9afa6e8c664abbf234fd9f1c0323ca17a5 Mon Sep 17 00:00:00 2001 From: Elijah Date: Mon, 25 May 2026 15:11:58 -0700 Subject: [PATCH] Fix: thumbnail worker payload for non-xlsx files and change timeout to interval for thumbnail updates --- backend/workers/thumbnails.go | 7 +++++-- frontend/src/components/FileExplorer.tsx | 9 ++++----- frontend/src/components/OfficeHome.tsx | 8 ++++---- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/backend/workers/thumbnails.go b/backend/workers/thumbnails.go index c114044..7c18335 100644 --- a/backend/workers/thumbnails.go +++ b/backend/workers/thumbnails.go @@ -167,12 +167,15 @@ func generateOfficeThumbnail(filePath, destPath string, cfg *config.Config) erro "width": 1024, "height": 1024, }, - "spreadsheetLayout": map[string]interface{}{ + } + + if ext == "xlsx" { + payload["spreadsheetLayout"] = map[string]interface{}{ "ignorePrintArea": true, "printGridlines": true, "printHeadings": true, "fitToWidth": 1, - }, + } } payloadBytes, err := json.Marshal(payload) diff --git a/frontend/src/components/FileExplorer.tsx b/frontend/src/components/FileExplorer.tsx index dd814fe..5b919b2 100644 --- a/frontend/src/components/FileExplorer.tsx +++ b/frontend/src/components/FileExplorer.tsx @@ -375,14 +375,13 @@ export default function FileExplorer({ onLogout }: FileExplorerProps) { } }, [currentPath, activeSection]); - // Refresh files after editing to catch the debounced thumbnail generation + // Refresh files periodically after editing to catch debounced background thumbnail generation useEffect(() => { if (!editingFile && activeSection === 'files') { - loadFiles(currentPath, true); - const timer = setTimeout(() => { + const timer = setInterval(() => { loadFiles(currentPath, true); - }, 12000); - return () => clearTimeout(timer); + }, 15000); + return () => clearInterval(timer); } }, [editingFile, activeSection, currentPath, loadFiles]); diff --git a/frontend/src/components/OfficeHome.tsx b/frontend/src/components/OfficeHome.tsx index b7a6516..6466217 100644 --- a/frontend/src/components/OfficeHome.tsx +++ b/frontend/src/components/OfficeHome.tsx @@ -123,11 +123,11 @@ export default function OfficeHome({ type, onFileSelect, onCreateBlank, onPinCha fetchFiles(); api.createDownloadToken().then(setDownloadToken).catch(console.error); - // Refresh files after 12 seconds to catch any debounced thumbnail updates from recent edits - const timer = setTimeout(() => { + // Refresh files periodically to catch any debounced thumbnail updates from recent edits + const timer = setInterval(() => { fetchFiles(); - }, 12000); - return () => clearTimeout(timer); + }, 15000); + return () => clearInterval(timer); }, [type]); // Close context menu on click elsewhere