Skip to content

Commit

Permalink
Fix crash in Combobox component when in virtual mode when options…
Browse files Browse the repository at this point in the history
… are empty (#3356)

* bump `@tanstack/react-virtual`

* only enable the virtualizer when there are options

* update changelog
  • Loading branch information
RobinMalfait committed Jul 2, 2024
1 parent 990b179 commit d65829b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/@headlessui-react/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Fix prematurely added anchoring styles on `ListboxOptions` ([#3337](https://github.com/tailwindlabs/headlessui/pull/3337))
- Ensure `unmount` on `Dialog` works in combination with the `transition` prop on `DialogBackdrop` and `DialogPanel` components ([#3352](https://github.com/tailwindlabs/headlessui/pull/3352))
- Fix crash in `Combobox` component when in `virtual` mode when options are empty ([#3356](https://github.com/tailwindlabs/headlessui/pull/3356))

## [2.1.1] - 2024-06-26

Expand Down
4 changes: 2 additions & 2 deletions packages/@headlessui-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
},
"dependencies": {
"@floating-ui/react": "^0.26.16",
"@tanstack/react-virtual": "3.5.0",
"@react-aria/focus": "^3.17.1",
"@react-aria/interactions": "^3.21.3"
"@react-aria/interactions": "^3.21.3",
"@tanstack/react-virtual": "^3.8.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ function VirtualProvider(props: {
}, [data.optionsRef.current])

let virtualizer = useVirtualizer({
enabled: options.length !== 0,
scrollPaddingStart: paddingStart,
scrollPaddingEnd: paddingEnd,
count: options.length,
Expand Down

0 comments on commit d65829b

Please sign in to comment.