summaryrefslogtreecommitdiff
path: root/components/Tweaks/OptionPanel.tsx
diff options
context:
space:
mode:
authorThomas F. K. Jorna <[email protected]>2022-01-04 15:40:44 +0100
committerGitHub <[email protected]>2022-01-04 15:40:44 +0100
commit0183a6f241623b3a943bf5d374869d3f50a93933 (patch)
tree9ab93fbc244a5719ae5c4530a4f9105053c641ee /components/Tweaks/OptionPanel.tsx
parentefe619f5ff1f227f223c9269ff8eed90a7cb481e (diff)
fix(#193): no subdirs should not break filtering (#195)
Diffstat (limited to 'components/Tweaks/OptionPanel.tsx')
-rw-r--r--components/Tweaks/OptionPanel.tsx11
1 files changed, 6 insertions, 5 deletions
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<typeof optionArray>(
- filter[listName].map((option) => {
+ filter[listName]?.map((option) => {
return {
value: option,
label: labelFilter ? (option as string)?.replace(labelFilter, '') : option,
}
- }),
+ }) || [],
)
return (