diff --git a/src/components/options.tsx b/src/components/options.tsx index 20fc432..1f1bf3f 100644 --- a/src/components/options.tsx +++ b/src/components/options.tsx @@ -26,7 +26,7 @@ export const Options: React.FC = (props) => { const handleSelectState = (e: React.ChangeEvent) => { if (Array.isArray(selectedOptions[optionKey])) { const newArray = [...selectedOptions[optionKey]]; - const newSelection: any = {[optionKey]: newArray}; + const newSelection = {[optionKey]: newArray}; if (e.currentTarget.checked) { newSelection[optionKey].push(e.target.value); // If user selects "Age", "Gender", or "Race", auto-select "Total Farmers" as well @@ -38,7 +38,7 @@ export const Options: React.FC = (props) => { newSelection.farmDemographics.push("Total Farms"); } // If user selects a crop and no unit is selected, auto-select Yield - if (optionKey === "crops" && !selectedOptions.cropUnits) { + if (optionKey === "crops" && !selectedOptions.cropUnits.length) { newSelection.cropUnits = ["Yield"]; } // If user selects a state, de-select "All States" @@ -95,7 +95,7 @@ export const Options: React.FC = (props) => { checked={isOptionSelected(o)} onChange={(e) => handleSelectState(e)} /> - + ); })}