diff --git a/app/src/frontend/building/data-containers/age-history.tsx b/app/src/frontend/building/data-containers/age-history.tsx index 8100cbd2..00caa7c7 100644 --- a/app/src/frontend/building/data-containers/age-history.tsx +++ b/app/src/frontend/building/data-containers/age-history.tsx @@ -65,12 +65,14 @@ const AgeView: React.FunctionComponent = (props) => { const switchToAgeMapStyle = (e) => { e.preventDefault(); - if (props.mapColourScale == "survival_status") - { + if (historicData === 'enabled') { historicDataSwitchOnClick(e); } + if (historicMap === 'enabled') { + historicMapSwitchOnClick(e); + } - props.onMapColourScale('date_year') + props.onMapColourScale('date_year'); } const switchToStylePeriodMapStyle = (e) => { @@ -498,7 +500,7 @@ const AgeView: React.FunctionComponent = (props) => { Choose a colour to indicate whether the building has survived. - {(historicMap == "enabled") ? + {(historicMap === "enabled") ? @@ -507,7 +509,7 @@ const AgeView: React.FunctionComponent = (props) => { Click here to show the 1890s OS historical map. } - {(historicData == "enabled") ? + {(historicData === "enabled") ? diff --git a/app/src/frontend/displayPreferences-context.tsx b/app/src/frontend/displayPreferences-context.tsx index a5b0094e..3bfcc1c3 100644 --- a/app/src/frontend/displayPreferences-context.tsx +++ b/app/src/frontend/displayPreferences-context.tsx @@ -297,7 +297,7 @@ export const DisplayPreferencesProvider: React.FC<{}> = ({children}) => { } flipHistoricData(e); }, - [historicData], + [historicData, historicMap], ) const historicDataSwitchOnClick = (e) => { flipHistoricData(e) @@ -315,7 +315,7 @@ export const DisplayPreferencesProvider: React.FC<{}> = ({children}) => { } fliphistoricMap(e); }, - [historicMap], + [historicMap, historicData], ) const historicMapSwitchOnClick = (e) => { fliphistoricMap(e)