From f5381ea82ae028687d35739029f35512b3cf71b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Prod=27homme?= Date: Fri, 8 Nov 2024 15:10:47 +0100 Subject: [PATCH] feat(client): activate dataset when changing setting of layer --- client/src/components/dataset-card/index.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/src/components/dataset-card/index.tsx b/client/src/components/dataset-card/index.tsx index a552f05..8e848cc 100644 --- a/client/src/components/dataset-card/index.tsx +++ b/client/src/components/dataset-card/index.tsx @@ -89,6 +89,8 @@ const DatasetCard = ({ id, name, defaultLayerId, layers }: DatasetCardProps) => // one keeping all the same settings (visibility, opacity, etc.) if (isDatasetActive && previousId !== undefined) { updateLayer(previousId, { id, ["return-period"]: returnPeriod }); + } else { + addLayer(id, { ["return-period"]: returnPeriod }); } }, [ @@ -96,6 +98,7 @@ const DatasetCard = ({ id, name, defaultLayerId, layers }: DatasetCardProps) => setSelectedLayerId, isDatasetActive, updateLayer, + addLayer, layers, layersConfiguration, ], @@ -109,9 +112,11 @@ const DatasetCard = ({ id, name, defaultLayerId, layers }: DatasetCardProps) => if (isDatasetActive && selectedLayerId !== undefined) { updateLayer(selectedLayerId, { ["return-period"]: returnPeriod }); + } else if (selectedLayerId !== undefined) { + addLayer(selectedLayerId, { ["return-period"]: returnPeriod }); } }, - [selectedLayerId, setSelectedReturnPeriod, isDatasetActive, updateLayer], + [selectedLayerId, setSelectedReturnPeriod, isDatasetActive, addLayer, updateLayer], ); return (