From 6ee9489a5fcfbbe74510836af6e12220006d611e Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 13 Oct 2025 09:56:26 +0100 Subject: [PATCH] Add debug logging for thumbnail generation and improve error handling --- dicom-viewer/src/App.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dicom-viewer/src/App.tsx b/dicom-viewer/src/App.tsx index 8be1810..4b75a05 100644 --- a/dicom-viewer/src/App.tsx +++ b/dicom-viewer/src/App.tsx @@ -437,6 +437,7 @@ function App({ container_id, imageStacks, autoCacheStack, annotationJson, viewer } // avoid regenerating if (stackThumbnails[stackIdx]) { + console.debug('generateThumbnail: thumbnail already exists for', stackIdx); // already have it return; } @@ -551,7 +552,9 @@ function App({ container_id, imageStacks, autoCacheStack, annotationJson, viewer console.warn('Thumbnail generation failed for', chosenImageId, err); try { setStackThumbnails(prev => ({ ...prev, [stackIdx]: 'BROKEN' })); } catch (e) { /* ignore */ } } 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); } }, [container_id, stackThumbnails]);