From 50ad98dae343cab81717cf4c01480c9e1d5e8edd Mon Sep 17 00:00:00 2001 From: Forrest Date: Mon, 12 Feb 2024 16:39:16 -0500 Subject: [PATCH] fix(useCurrentImage): return defaults/null --- src/composables/useCurrentImage.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/composables/useCurrentImage.ts b/src/composables/useCurrentImage.ts index 71a82d3c..804b2745 100644 --- a/src/composables/useCurrentImage.ts +++ b/src/composables/useCurrentImage.ts @@ -46,12 +46,13 @@ export function getImageSpatialExtent(imageID: Maybe) { export function getImageMetadata(imageID: Maybe) { const { metadata } = useImageStore(); - return imageID ? metadata[imageID] : defaultImageMetadata(); + if (!imageID) return defaultImageMetadata(); + return metadata[imageID] ?? defaultImageMetadata(); } export function getImageData(imageID: Maybe) { const { dataIndex } = useImageStore(); - return imageID ? dataIndex[imageID] : null; + return imageID ? dataIndex[imageID] ?? null : null; } export function getIsImageLoading(imageID: Maybe) {