yairEO / tagify

🔖 lightweight, efficient Tags input component in Vanilla JS / React / Angular / Vue
https://yaireo.github.io/tagify/
Other
3.55k stars 436 forks source link

Unclear behaviour with AJAX whitelist and fuzzySearch, "old" suggestion gets selected #1399

Open stroebjo opened 3 weeks ago

stroebjo commented 3 weeks ago

Prerequisites

Demo Page

https://jsbin.com/putacayuba/edit?html,js,console,output

Explanation

I use tagify with the suggested method for a dynamic whitelist via AJAX.

When you type in data architecture in the JSBin example above, it works as expected, but when you type data collaboration, and hit enter the resulting tag is data architecture. The suggestion stays even though the AJAX whitelist returns an empty list ([]) after the value data c.

This is not the case for Star Wars (present in the AJAX) and Star Gate (not present), or foo bar/foo test.

Setting dropdown.fuzzySearch to false "fixes" this behaviour for the data collaboration example. But is this expeced?

In case of a static whitelist with fuzzySearch enabled, it works as expected (https://jsbin.com/qeronobori/1/edit?html,js,output).