Skip to content

[Bug]: New 'label' value is not displayed when second search returened the item with the same value but different label #854

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

Open
KES777 opened this issue Jan 8, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@KES777
Copy link

KES777 commented Jan 8, 2025

Bug description

When I do the first search the return list is [{ label: 'x', value: 1 }].
When I do the second search the return list is [{ label: 'y', value: 1 }]. (eg. between searches someone updated the label in database).

But the TomSelect still displays the old label 'x'.

Expected behavior

I expect when new data comes all existing items should be updated, eg. 'x' should be replaced by 'y'.

Steps to reproduce

  1. Do the first search which should return [{ label: 'x', value: 1 }]
  2. Do the second search which should return [{ label: 'y', value: 1 }]
  3. You still see 'x' at the drop down, but it should be 'y'.

Additional context

  • OS: Linux Mint
  • Browser FF
  • Version 130
  • Device: Desktop
@JSteitz
Copy link

JSteitz commented Jan 12, 2025

Please add the options you used.

@KES777
Copy link
Author

KES777 commented Jan 14, 2025

All options are default except the load which just queries data from my localhost.

@Gigitsu
Copy link

Gigitsu commented May 2, 2025

I have a very similar problem, and it might be enough to change this line from:

		if( key === null || self.options.hasOwnProperty(key) ){

to:

		if( key === null ){

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants