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
{{ message }}
Repository navigation
Collections: Allow skipping components/effects during collection building in hidden tree #10957
Components that support collections like Select render their children (e.g. Popover with ListBox) initially in a hidden tree to build the collection. Custom wrappers around React Aria Components like the Popover may include additional components that trigger side-effects. These effects then run during the initial rendering, even if the popover / listbox is not actually rendered in the DOM / visible in the UI. That's unexpected and should be avoided.
🤔 Expected Behavior?
Components with side-effects should not be rendered (or shouldn't execute their side-effects) while in the hidden tree.
😯 Current Behavior
Side-effects also run while components are rendered in the hidden tree.
💁 Possible Solution
A possible solution could be to export the useIsHidden() hook and let consumers handle it.
I created the issue from discussion #10944 . snowystinger mentioned:
we need to make this easier to address. I'm not sure what that looks like yet, whether it's exposing useIsHidden publicly or something else.
Maybe the answer is just better documentation around it, but I hope we can do something to make it easier than that. I'd love if people didn't need to know about or think about the hidden collection tree
🔦 Context
We use TanStack Hotkeys for keyboard shortcuts in our app. If a modal popover / dialog is open, we only want to allow shortkeys registerd within the dialog and block other shortcuts on the page. TanStack provides HotkeysProvider for this scenario. A popover can render this provider with the "exlusive" prop. The problem is now, that this provider is rendered during the collection building, which disables all shortcuts on the page even if Select isn't actually open.
A workaround for now is to disable the provider while the select is closed, which requires the Select to forward its open state to the popover.
Activity