You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi again - I'm running in to an issue when trying to use SelectStateContext to determine if there is a value in order to show a "remove selection" option in the Select ListBox. But I cannot get my list to render an additional item based on a conditional from a component inside a popover, even if I add it as a dependency at every level of the collection. I've tried different cache busting approaches i promise. Maybe I'm missing something though
🤔 Expected Behavior?
I expect to be able to use const state = useContext(SelectStateContext); specifically the value prop from state to add a list item so that the user can "deselect" from the list
😯 Current Behavior
Currently even though the value of Boolean(state?.value) shows as true or false in the logs and the list of items re-render, the collection itself doesn't show the newly added item
💁 Possible Solution
I swear ive double and triple checked traditional caching issues ive run in to before (duplicate ids, not using dependency array) and i still cannot get it to work. I did some investigation and the TLDR i've come up with so far is:
State that lives inside a component rendered within Select's Popover seemingly can't control which items exist in the collection. Maybe it's because Select renders a hidden copy of its children to build the collection, so any useState inside that subtree is a separate instance from the one I interact with in the visible UI? As a result, toggling local state in the real tree doesn't affect the hidden tree's copy, so the collection never updates. The fix I've found is to lift any state that controls collection structure above the Select.
I also confirmed that if you remove the Virtualizer, it still is a problem.
Is this something that is necessary or worthy of tracking as a bug?
🔦 Context
I'm just trying to implement a select component that shows a deselect option if a value in the select is defined.
It's probably worth watching all 3 in a row first to understand what I'm finally trying to accomplish.
Trying to use useContext (cannot get Clear selection to show after I select an item and reopen the Select) ❌
Screen.Recording.2026-06-13.at.2.09.37.AM.mov
Trying to use local useState (cannot get Clear selection to show after I select an item and reopen the Select) ❌
Screen.Recording.2026-06-13.at.2.10.16.AM.mov
Trying to use parent useState (allows the Clear selection to show) ✅
Provide a general summary of the issue here
Hi again - I'm running in to an issue when trying to use
SelectStateContextto determine if there is avaluein order to show a "remove selection" option in the Select ListBox. But I cannot get my list to render an additional item based on a conditional from a component inside a popover, even if I add it as a dependency at every level of the collection. I've tried different cache busting approaches i promise. Maybe I'm missing something though🤔 Expected Behavior?
I expect to be able to use
const state = useContext(SelectStateContext);specifically thevalueprop fromstateto add a list item so that the user can "deselect" from the list😯 Current Behavior
Currently even though the value of
Boolean(state?.value)shows astrueorfalsein the logs and the list of items re-render, the collection itself doesn't show the newly added item💁 Possible Solution
I swear ive double and triple checked traditional caching issues ive run in to before (duplicate ids, not using dependency array) and i still cannot get it to work. I did some investigation and the TLDR i've come up with so far is:
State that lives inside a component rendered within Select's Popover seemingly can't control which items exist in the collection. Maybe it's because Select renders a hidden copy of its children to build the collection, so any useState inside that subtree is a separate instance from the one I interact with in the visible UI? As a result, toggling local state in the real tree doesn't affect the hidden tree's copy, so the collection never updates. The fix I've found is to lift any state that controls collection structure above the Select.
I also confirmed that if you remove the Virtualizer, it still is a problem.
Is this something that is necessary or worthy of tracking as a bug?
🔦 Context
I'm just trying to implement a select component that shows a deselect option if a value in the select is defined.
It's probably worth watching all 3 in a row first to understand what I'm finally trying to accomplish.
Screen.Recording.2026-06-13.at.2.09.37.AM.mov
Screen.Recording.2026-06-13.at.2.10.16.AM.mov
Screen.Recording.2026-06-13.at.2.14.35.AM.mov
🖥️ Steps to Reproduce
Stackblitz: https://stackblitz.com/edit/vrrrd46r?file=src%2FExample.tsx
useContext case (fails)
useState case (fails)
I tried forcing this by adding a toggleable useState boolean to see if it was a problem with the
useContext(spoiler: it's not)const isClearable = isClearableFromSelectContext;and uncommentconst isClearable = fakeClearable;useContextcase aboveWhat DOES work is if you hoist the
useStateinto the parent of DebugListBox and passfakeClearableas a prop ofDebugListBox.Version
1.18.0
What browsers are you seeing the problem on?
Chrome
If other, please specify.
No response
What operating system are you using?
MacOS
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response