Skip to content

Commit

Permalink
feat(client): activate dataset when changing setting of layer
Browse files Browse the repository at this point in the history
  • Loading branch information
clementprdhomme committed Nov 8, 2024
1 parent 925fc53 commit f5381ea
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion client/src/components/dataset-card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,16 @@ 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 });
}
},
[
selectedLayerId,
setSelectedLayerId,
isDatasetActive,
updateLayer,
addLayer,
layers,
layersConfiguration,
],
Expand All @@ -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 (
Expand Down

0 comments on commit f5381ea

Please sign in to comment.