diff options
author | Thomas F. K. Jorna <[email protected]> | 2021-08-03 13:18:38 +0200 |
---|---|---|
committer | Thomas F. K. Jorna <[email protected]> | 2021-08-03 13:18:38 +0200 |
commit | a0f0e5aabee5b3bad68afb7eab092b684275e6fa (patch) | |
tree | 9e1e5a4e14aabb383c3b2c3989f4c70fcdf42ab1 /components | |
parent | 44cbce4390aee4c96d729261953874a58d4349f7 (diff) |
fix: make tags update correctly and show them on refresh
Diffstat (limited to 'components')
-rw-r--r-- | components/tweaks.tsx | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/components/tweaks.tsx b/components/tweaks.tsx index cb1fec0..5561a1b 100644 --- a/components/tweaks.tsx +++ b/components/tweaks.tsx @@ -1299,7 +1299,11 @@ export const TagPanel = (props: TagPanelProps) => { }) // .concat[{ value: 'placeholder', label: 'New filter' }] - const [selectedItems, setSelectedItems] = useState<typeof tagArray>([]) + const [selectedItems, setSelectedItems] = useState<typeof tagArray>( + filter.tags.map((tag) => { + return { value: tag, label: tag } + }), + ) return ( <CUIAutoComplete @@ -1312,7 +1316,7 @@ export const TagPanel = (props: TagPanelProps) => { onSelectedItemsChange={(changes) => { if (changes.selectedItems) { setSelectedItems(changes.selectedItems) - setFilter({ ...filter, tags: selectedItems.map((item) => item.value) }) + setFilter({ ...filter, tags: changes.selectedItems.map((item) => item.value) }) } }} listItemStyleProps={{ overflow: 'hidden' }} @@ -1349,7 +1353,11 @@ export const TagColorPanel = (props: TagColorPanelProps) => { return { value: tag, label: tag } }) - const [selectedItems, setSelectedItems] = useState<typeof tagArray>([]) + const [selectedItems, setSelectedItems] = useState<typeof tagArray>( + Object.keys(tagColors).map((tag) => { + return { value: tag, label: tag } + }), + ) return ( <Box> |