Add debug logging for thumbnail generation and improve error handling

This commit is contained in:
Ross
2025-10-13 09:56:26 +01:00
parent 6e70a32ffe
commit 6ee9489a5f
+4 -1
View File
@@ -437,6 +437,7 @@ function App({ container_id, imageStacks, autoCacheStack, annotationJson, viewer
} }
// avoid regenerating // avoid regenerating
if (stackThumbnails[stackIdx]) { if (stackThumbnails[stackIdx]) {
console.debug('generateThumbnail: thumbnail already exists for', stackIdx);
// already have it // already have it
return; return;
} }
@@ -551,7 +552,9 @@ function App({ container_id, imageStacks, autoCacheStack, annotationJson, viewer
console.warn('Thumbnail generation failed for', chosenImageId, err); console.warn('Thumbnail generation failed for', chosenImageId, err);
try { setStackThumbnails(prev => ({ ...prev, [stackIdx]: 'BROKEN' })); } catch (e) { /* ignore */ } try { setStackThumbnails(prev => ({ ...prev, [stackIdx]: 'BROKEN' })); } catch (e) { /* ignore */ }
} finally { } finally {
try { renderingEngine.disableElement(viewportId); } catch (e) { /* ignore */ } try { renderingEngine.disableElement(viewportId); } catch (e) {
console.warn('Failed to disable thumbnail element:', e);
}
if (el && el.parentNode) el.parentNode.removeChild(el); if (el && el.parentNode) el.parentNode.removeChild(el);
} }
}, [container_id, stackThumbnails]); }, [container_id, stackThumbnails]);