Skip to content

Commit

Permalink
fix: Avoid 'key prop spread into JSX' warning.
Browse files Browse the repository at this point in the history
React 18.3 detects `key` being spread and doesn't like it.
  • Loading branch information
stephenh committed Oct 18, 2024
1 parent 72c7dae commit f66ea1a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/inputs/internal/VirtualizedOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export function VirtualizedOptions<O>(props: VirtualizedOptionsProps<O>) {
return (
<Virtuoso
ref={virtuosoRef}
key={items.length}
totalListHeightChanged={onListHeightChange}
totalCount={items.length}
{...(process.env.NODE_ENV === "test"
Expand All @@ -64,7 +65,6 @@ export function VirtualizedOptions<O>(props: VirtualizedOptionsProps<O>) {
// otherwise render just 1 row. A better way to do this would be to jest.mock
// out Virtuoso with an impl that just rendered everything, but doing this for now.
initialItemCount: items.length,
key: items.length,
}
: {
// Ensure the selected item is visible when the list renders
Expand Down

0 comments on commit f66ea1a

Please sign in to comment.