Skip to content

Commit

Permalink
Pass format settings from redux store (deephaven#393)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmingles committed Mar 28, 2024
1 parent 3779429 commit e78ca04
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions plugins/ui/src/js/src/elements/Picker.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { ReactElement } from 'react';
import { useSelector } from 'react-redux';
import {
Picker as DHPicker,
PickerProps as DHPickerProps,
Expand All @@ -8,6 +9,7 @@ import {
PickerProps as DHPickerJSApiProps,
} from '@deephaven/jsapi-components';
import { isElementOfType, usePromiseFactory } from '@deephaven/react-hooks';
import { getSettings, RootState } from '@deephaven/redux';
import { SerializedPickerEventProps, usePickerProps } from './usePickerProps';
import ObjectView, { ObjectViewProps } from './ObjectView';
import { fetchReexportedTable } from './ElementUtils';
Expand All @@ -20,6 +22,7 @@ export type PickerProps = (DHPickerProps | WrappedDHPickerJSApiProps) &
SerializedPickerEventProps;

function Picker({ children, ...props }: PickerProps) {
const settings = useSelector(getSettings<RootState>);
const pickerProps = usePickerProps(props);

const maybeExportedObject = isElementOfType(children, ObjectView)
Expand All @@ -31,8 +34,12 @@ function Picker({ children, ...props }: PickerProps) {
]);

if (isElementOfType(children, ObjectView)) {
// eslint-disable-next-line react/jsx-props-no-spreading
return table && <DHPickerJSApi {...pickerProps} table={table} />;
return (
table && (
// eslint-disable-next-line react/jsx-props-no-spreading
<DHPickerJSApi {...pickerProps} table={table} settings={settings} />
)
);
}

// eslint-disable-next-line react/jsx-props-no-spreading
Expand Down

0 comments on commit e78ca04

Please sign in to comment.