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

Taglist adds duplicate options when loaded from an API #497

Closed
jerrebm opened this issue Nov 29, 2022 · 5 comments
Closed

Taglist adds duplicate options when loaded from an API #497

jerrebm opened this issue Nov 29, 2022 · 5 comments
Assignees
Labels
🐛 bug Verified bug by team Pro Pertains to FormKit Pro

Comments

@jerrebm
Copy link

jerrebm commented Nov 29, 2022

Reproduction

https://formkit.link/1439704f7483844193e5b340a36a0caf

Describe the bug

I'm loading options for the taglist component via an API call instead of assigning them directly.

The sample code of the Loading options section in the documentation returns an empty array when no search query is provided:

if (!search) return [];

For my use case, I always want to return a list of options, even if no query has been provided (yet).

When clicking on the taglist input to open the option list, this works fine the first time. But when clicking away to close the options list (without typing or selecting anything) the taglist executes a 'search' request on close and appends the results to the existing options. Effectively duplicating the options list every time the input is closed.

I've provided an example in the reproduction link. Simply click on the input field (one option will show), click away, and click again (option is duplicated). More duplicate options are added every time you repeat this step.

Environment

• OS: [e.g. iOS]
• Browser [e.g. chrome, safari]
• Version [e.g. 22]

@jerrebm jerrebm added ⛑ Needs triage The issue has not yet been examined by the FormKit team. 🐛 bug-report Bug is reported, but not verified by team labels Nov 29, 2022
@sashamilenkovic sashamilenkovic self-assigned this Nov 29, 2022
@sashamilenkovic sashamilenkovic added this to the Beta 13 milestone Nov 29, 2022
@sashamilenkovic sashamilenkovic added 🐛 bug Verified bug by team Pro Pertains to FormKit Pro and removed 🐛 bug-report Bug is reported, but not verified by team ⛑ Needs triage The issue has not yet been examined by the FormKit team. labels Nov 29, 2022
@sashamilenkovic
Copy link
Contributor

sashamilenkovic commented Nov 29, 2022

@jerrebm https://formkit.link/0b70b52e8727342e302e9336cff120fa. Should be fixed on @next tag. You wanna see if this works for you?

@sashamilenkovic sashamilenkovic added the 🚀 release-ready Feature or fix is complete and on an upcoming release branch label Nov 29, 2022
@jerrebm
Copy link
Author

jerrebm commented Nov 30, 2022

@sashamilenkovic the playground for version 1.0.0-beta.13 (next) still has the same issue for me, unfortunately.

@sashamilenkovic
Copy link
Contributor

@jerrebm Try hard reloading

@jerrebm
Copy link
Author

jerrebm commented Nov 30, 2022

@sashamilenkovic Working! 👍

@sashamilenkovic
Copy link
Contributor

@jerrebm Perfect!

@sashamilenkovic sashamilenkovic removed the 🚀 release-ready Feature or fix is complete and on an upcoming release branch label Feb 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Verified bug by team Pro Pertains to FormKit Pro
Projects
None yet
Development

No branches or pull requests

2 participants