From 01a3328ec2ac1964d30e368703383e4cc0bce409 Mon Sep 17 00:00:00 2001 From: Dana Lambert Date: Fri, 5 Nov 2021 14:31:32 +1300 Subject: [PATCH] Update habitat selector to reset image/zone on habitat change --- frontend/src/components/steps/habitat/HabitatSelector.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/steps/habitat/HabitatSelector.js b/frontend/src/components/steps/habitat/HabitatSelector.js index 47ec52b..eeae7c9 100644 --- a/frontend/src/components/steps/habitat/HabitatSelector.js +++ b/frontend/src/components/steps/habitat/HabitatSelector.js @@ -43,11 +43,12 @@ export default function HabitatSelector(props) { props.setNextDisabled(false); } }); - + const setHabitatImage = (imageId) => { // Sets the selected image radio, updates filter state for image and enable the next button setImageValue(imageId); props.updateFilterState({ "habitatImage": imageId }); + props.updateFilterState({ "zone": null }); props.setNextDisabled(false); } @@ -55,6 +56,8 @@ export default function HabitatSelector(props) { // Retrieve and set the value of the radio button const habitatSelection = event.target.value; setValue(habitatSelection); + setHabitatImage(null) + // Set the image default selection if there is only one image variation available const habitatObject = habitatsMap[habitatSelection]