From 0183a6f241623b3a943bf5d374869d3f50a93933 Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Tue, 4 Jan 2022 15:40:44 +0100 Subject: fix(#193): no subdirs should not break filtering (#195) --- components/Tweaks/OptionPanel.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'components') diff --git a/components/Tweaks/OptionPanel.tsx b/components/Tweaks/OptionPanel.tsx index 870028b..aa9523c 100644 --- a/components/Tweaks/OptionPanel.tsx +++ b/components/Tweaks/OptionPanel.tsx @@ -15,17 +15,18 @@ export interface OptionPanelProps { export const OptionPanel = (props: OptionPanelProps) => { const { filter, listName, labelFilter, displayName, setFilter, options = [] } = props const { highlightColor } = useContext(ThemeContext) - const optionArray = options.map((option) => { - return { value: option, label: labelFilter ? option.replace(labelFilter, '') : option } - }) + const optionArray = + options?.map((option) => { + return { value: option, label: labelFilter ? option.replace(labelFilter, '') : option } + }) || [] const [selectedItems, setSelectedItems] = useState( - filter[listName].map((option) => { + filter[listName]?.map((option) => { return { value: option, label: labelFilter ? (option as string)?.replace(labelFilter, '') : option, } - }), + }) || [], ) return ( -- cgit v1.2.3