Skip to content

Commit

Permalink
Fixed wrappeditems error (deephaven#1890)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmingles committed Apr 29, 2024
1 parent b450090 commit 6c1a83f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
8 changes: 4 additions & 4 deletions packages/components/src/spectrum/picker/Picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ export function Picker({
const [uncontrolledSelectedKey, setUncontrolledSelectedKey] =
useState(defaultSelectedKey);

const wrappedItems = useMemo(
() => wrapItemChildren(children, tooltipOptions),
[children, tooltipOptions]
);
const wrappedItems = useMemo(() => {
const wrapped = wrapItemChildren(children, tooltipOptions);
return Array.isArray(wrapped) ? wrapped : [wrapped];
}, [children, tooltipOptions]);

// Item descriptions and Section elements introduce variable item heights.
// This throws off scroll position calculations, so we disable auto scrolling
Expand Down
5 changes: 1 addition & 4 deletions packages/components/src/spectrum/utils/itemUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ export const ITEM_EMPTY_STRING_TEXT_VALUE = 'Empty';
* an incoming prop.
*/
type SectionPropsNoItemRenderer<T> = Omit<SectionProps<T>, 'children'> & {
children:
| Exclude<SectionProps<T>['children'], ItemRenderer<T>>
| ItemElementOrPrimitive<T>
| ItemElementOrPrimitive<T>[];
children: Exclude<SectionProps<T>['children'], ItemRenderer<T>>;
};

export type ItemElement<T = unknown> = ReactElement<ItemProps<T>>;
Expand Down

0 comments on commit 6c1a83f

Please sign in to comment.