CaptainCodeman / svelte-headlessui

HeadlessUI components for Svelte
https://captaincodeman.github.io/svelte-headlessui/
MIT License
529 stars 25 forks source link

User specified `id` on combobox list item causes infinite loop #76

Closed codewithcheese closed 1 month ago

codewithcheese commented 9 months ago

Hi, loving the concept and implementation of this library, being able to bring your own HTML and then adding actions to get the required functionality feels like a real solution for headless UI logic finally. Thank you!

I encountered an infinite state update loop due to an id being set on the combobox list item. Here's what I mean https://github.com/codewithcheese/svelte-headlessui/commit/d7ff662392875d6911eed524dd7d476cc79673f6

I was copying some HTML from tailwindui which had ids set. I see this breaks how the library uses ids internally, and I now know to remove them.

This was hard to debug and not a pleasant DX. If the goal is for users to bring actions to their own HTML then this could be a common pitfall. Not sure of the solution, maybe even just a warning would help

CaptainCodeman commented 9 months ago

It would probably make sense to just keep any existing ID if there was one.