Skip to content

Restrict available options but allow duplicates? #110

@singh87

Description

@singh87

I am running into an issue where I need to restrict the available options but also allow duplicates in the selected list. I thought I was doing something wrong at first but then I looked into the code and saw that these two options are not allowed to coexist. I'm just trying to figure out why this is and how easy would it be to allow both options

if (allowDuplicates) {
            // If we allow duplicates, all options will always be available
            filterer = () => true;
        } else if (available !== undefined) {
            // If the caller is restricting the available options, combine that with the default
            filterer = (option) => (
                this.getFlatOptions(available).indexOf(option.value) >= 0 &&
                this.getFlatOptions(selected).indexOf(option.value) < 0
            );
        }```

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions