Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3 tasks done
stroebjo opened this issue Oct 28, 2024 · 4 comments
Open
3 tasks done

Comments

@stroebjo
Copy link

stroebjo commented Oct 28, 2024

Prerequisites

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

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).

@yairEO
Copy link
Owner

yairEO commented Jan 10, 2025

hi, sorry for the delay. can you create a simpler JSBin demo without all the PHP, which actually works? simulate a server response with a delay with you need.

@stroebjo
Copy link
Author

Hi, since the issue appears to be depending on the filtering of the AJAX results on the server, I do not know how to reproduce/mimic that behaviour with a JSBin alone. So I'm not sure how to provide a simpler test-case?

I put the PHP script on my server and referenced it in the JSBin to showcase the issue.

@yairEO
Copy link
Owner

yairEO commented Jan 14, 2025

I don't know PHP and you can mimic anything.. just describe it to an AI like Gemini to Claude Sonnet and give it a try

@stroebjo
Copy link
Author

Hi, I managed to create a demo with JSBin only: https://jsbin.com/yiqitacuna/5/edit?html,js,console,output

As mentioned above: wenn you enter data collaboration the suggestion data architecture persists and is not cleared, so after typing data collaboration and hitting enter data architecture is used instead. This does not happen for the pair Star Wars (present in the suggestions) and Star Trek (new). So I think it's somehow related to the fuzzy search for suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants