Skip to content

Commit 062f869

Browse files
committed
fix(FilterPicker): select custom value without duplicates
1 parent dbef0b0 commit 062f869

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/components/fields/FilterListBox/FilterListBox.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ export const WithCustomStyles: StoryFn = () => (
11001100
searchPlaceholder="Search with custom styles..."
11011101
selectionMode="multiple"
11021102
styles={{
1103-
fill: '#gradient(to right, #purple.20, #blue.20)',
1103+
backgroundImage: 'linear-gradient(to right, #purple.20, #danger.20)',
11041104
border: '2bw solid #purple',
11051105
radius: '2r',
11061106
}}

src/components/fields/FilterListBox/FilterListBox.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,12 @@ export const FilterListBox = forwardRef(function FilterListBox<
536536

537537
// Helper to determine if the term is already present (exact match on rendered textValue or the key).
538538
const doesTermExist = (term: string): boolean => {
539+
// Check if term exists in custom keys
540+
if (customKeys.has(term)) {
541+
return true;
542+
}
543+
544+
// Check if term exists in original collection
539545
for (const item of localCollectionState.collection) {
540546
if (item.type === 'item') {
541547
const textValue = item.textValue || String(item.rendered || '');

0 commit comments

Comments
 (0)