question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Taglist adds duplicate options when loaded from an API

See original GitHub issue

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]

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jerrebmcommented, Nov 30, 2022

@sashamilenkovic Working! 👍

0reactions
sashamilenkoviccommented, Nov 30, 2022

@jerrebm Perfect!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Duplicate Items in List from Network Api Call Android
Try clearing the list before adding items instead of clearing it on ... you might want to add a mechanism to request only...
Read more >
How to Avoid Duplicate API Requests? - Daffodil Software
Here is what leads to duplicate API request issues and how to overcome the problem.
Read more >
We are receiving duplicate values while retrieving...
We are receiving duplicate values while retrieving records by pagination using APIs. Hi ServiceNow team, We are having an API integration in ...
Read more >
TagList Class (DocumentFormat.OpenXml.Presentation)
TagList (String). Initializes a new instance of the TagList class from outer XML. ... Creates a duplicate of the current node. ... Load(UserDefinedTagsPart)....
Read more >
Insert Account Id of duplicate record in API REST Response
How can I add the AccountId of the duplicate record in the response? Bulk API - Load data from an old database full...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found