Skip to content

Result picked twice with multiple keys defined #220

Answered by TarekRaafat
ludovi-com asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @ludovi-com,

I'm not getting the first part clearly reset the autocomplete object every time the search criteria is changed I would appreciate it if you could explain more on this point maybe I could help you with it.

Regarding, getting duplicated results is normal when you use data.key so to handle duplicates you need to use the filter snippet below.

Please, try it and let me know how it goes.

{
    data: {
        src: ... ,
        key: [name, surname, id],
        results: (list) => {
            // Filter duplicates
            // incase of multiple data keys usage
            const filteredResults = Array.from(new Set(list.map((value) => value.match))).map((id) => {

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@ludovi-com
Comment options

@TarekRaafat
Comment options

Answer selected by ludovi-com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants