From 34cec446b492c0d8dd3f5db66f3bf5e36fe775d3 Mon Sep 17 00:00:00 2001 From: Friedjoff Trautwein Date: Sat, 10 Oct 2020 10:20:03 +0200 Subject: [PATCH] feat: reset form location if forest type is missing in options --- src/store/enhancers/projection.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/store/enhancers/projection.js b/src/store/enhancers/projection.js index aafdbd55..0eba3a14 100644 --- a/src/store/enhancers/projection.js +++ b/src/store/enhancers/projection.js @@ -7,6 +7,7 @@ import { SET_FORM_LOCATION, SET_MAP_LOCATION, SET_PROJECTION_MODE, + setFormLocation, setLocation, setLocationResult, setProjectionResult, @@ -70,6 +71,15 @@ const projection = (store) => (next) => (action) => { } = mapLocation; projectionResult.moderate = runProject(location, targetAZModerate); projectionResult.extreme = runProject(location, targetAZExtreme); + + const { options } = projectionResult.extreme; + if ( + location.forestType && + options.forestType && + options.forestType.includes(location.forestType) === false + ) { + store.dispatch(setFormLocation({ forestType: null })); + } } else { const { targetAltitudinalZone: targetAZForm } = formLocation; projectionResult.form = runProject(location, targetAZForm);