From adf4ea05f05349869f7316cd626a48fc52d5bdde Mon Sep 17 00:00:00 2001 From: hvangeffen Date: Fri, 26 Apr 2024 14:37:02 +0200 Subject: [PATCH] Let styles still be undefined in case there is no layerName --- .../spatialdisplay/SpatialDisplayComponent.vue | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/components/spatialdisplay/SpatialDisplayComponent.vue b/src/components/spatialdisplay/SpatialDisplayComponent.vue index 179fd740d..07d67feda 100644 --- a/src/components/spatialdisplay/SpatialDisplayComponent.vue +++ b/src/components/spatialdisplay/SpatialDisplayComponent.vue @@ -203,7 +203,7 @@ const isLoading = ref(false) let debouncedSetLayerOptions!: () => void const legendLayerName = ref(props.layerName) -const legendLayerStyles = ref([]) +const legendLayerStyles = ref() const settings = useUserSettingsStore() const baseUrl = configManager.get('VITE_FEWS_WEBSERVICES_URL') @@ -327,11 +327,15 @@ watch( new Date(layer?.keywordList[0].forecastTime as string) ?? null } legendLayerName.value = props.layerName - legendLayerStyles.value = props.layerCapabilities?.styles ?? [ - { - title: props.layerName, - }, - ] + legendLayerStyles.value = props.layerCapabilities?.styles + if (legendLayerStyles.value === undefined && props.layerName) { + legendLayerStyles.value = [ + { + title: props.layerName, + }, + ] + } + if (layer?.elevation) { const max = layer.elevation.upperValue ?? 0 const min = layer.elevation.lowerValue ?? 0