Closed RobinMalfait closed 1 week ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
headlessui-react | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jun 20, 2024 2:05pm |
headlessui-vue | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jun 20, 2024 2:05pm |
This PR improves the UX when you are closing a
Combobox
that uses aTransition
while closing.Typically the
Combobox
component is used with a filtered list based on the value of theComboboxInput
. When theCombobox
closes then theonClose
will be called. In this function you typically reset the search query state as well:Notice that we use
setQuery('')
in theonClose
.If you are using a transition, then the following things will happen:
Combobox
is closedonClose
is triggered, theComboboxOptions
are transitioning outquery
is resetfilteredPeople
list is updated (not filtered yet)ComboboxOptions
re-renders with the "full" list instead of the filtered list.Transition
completes after this.This now means that while transitioning out, the
ComboboxOptions
is re-rendering with a new list of options even though you just selected an option.This PR now will "freeze" that state so that we show the contents at the time of closing the
Combobox
.