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

[TagInput] onInputValueChange invoked on onValueChange #1954

Open
renchris opened this issue Oct 20, 2024 · 0 comments
Open

[TagInput] onInputValueChange invoked on onValueChange #1954

renchris opened this issue Oct 20, 2024 · 0 comments

Comments

@renchris
Copy link

🐛 Bug report

Need a way to invoke the onInputValueChange tagsInput hook not be invoked when the the onValueChange tagsInput hook is invoked

Ie. When we submit a tag by input keyboard enter instead of clicking the dropdown, both of the callbacks get called and we cannot handle the dropdown filter logic properly. onInputValueChange I just want to filter based of the input text so far and onValueChange I want to filter based of off what options there are left

Even the paid example has this bug with the filtering not working properly. If you select a number of options, then delete them all, and select another option again, all of the deleted options show up along with the new selected option

  const tagInput = useTagsInput({
    onInputValueChange: handleInputChange,
    onValueChange: handleValueChange,
    validate: (details) => initialItems.includes(details.inputValue)
    && !details.value.includes(details.inputValue),
  })

https://www.loom.com/share/f33c9412b21f43cbbefb0ab951ac8b21

💥 Steps to reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

💻 Link to reproduction

CodeSandbox reproduction: https://your-codesandbox-link-goes-here.io

🧐 Expected behavior

I expect to be able to properly filter the dropdown items upon select as well as input type

🧭 Possible Solution

🌍 System information

Software Version(s)
Zag Version 0.74.2 (Ark 4.1.2)
Browser Chrome Version 129.0.6668.101 (Official Build) (arm64)
Operating System MacOS Sonoma 14.6.1

📝 Additional information

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

1 participant