From 43e5c7dc9f1736a4894e238e69f6fa39b51ef096 Mon Sep 17 00:00:00 2001 From: Brian Ingles Date: Wed, 3 Apr 2024 10:43:05 -0500 Subject: [PATCH] Addressed review comments (#293) --- plugins/ui/src/js/src/DashboardPlugin.tsx | 6 +----- plugins/ui/src/js/src/elements/Picker.tsx | 11 +++++++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/plugins/ui/src/js/src/DashboardPlugin.tsx b/plugins/ui/src/js/src/DashboardPlugin.tsx index 6d966144b..a5e137fec 100644 --- a/plugins/ui/src/js/src/DashboardPlugin.tsx +++ b/plugins/ui/src/js/src/DashboardPlugin.tsx @@ -34,7 +34,6 @@ import DashboardWidgetHandler from './widget/DashboardWidgetHandler'; const NAME_ELEMENT = 'deephaven.ui.Element'; const DASHBOARD_ELEMENT = 'deephaven.ui.Dashboard'; -const TABLE_TYPE = 'Table'; const PLUGIN_NAME = '@deephaven/js-plugin-ui.DashboardPlugin'; const log = Log.module('@deephaven/js-plugin-ui.DashboardPlugin'); @@ -145,11 +144,8 @@ export function DashboardPlugin( handleDashboardOpen({ widget, dashboardId: widgetId }); break; } - case TABLE_TYPE: { - break; - } default: { - log.error('Unknown widget type', type); + break; } } }, diff --git a/plugins/ui/src/js/src/elements/Picker.tsx b/plugins/ui/src/js/src/elements/Picker.tsx index e30878782..dc4d36ae5 100644 --- a/plugins/ui/src/js/src/elements/Picker.tsx +++ b/plugins/ui/src/js/src/elements/Picker.tsx @@ -6,6 +6,7 @@ import { import { Picker as DHPickerJSApi, PickerProps as DHPickerJSApiProps, + useTableClose, } from '@deephaven/jsapi-components'; import { isElementOfType, usePromiseFactory } from '@deephaven/react-hooks'; import { SerializedPickerEventProps, usePickerProps } from './usePickerProps'; @@ -22,15 +23,17 @@ export type PickerProps = (DHPickerProps | WrappedDHPickerJSApiProps) & function Picker({ children, ...props }: PickerProps) { const pickerProps = usePickerProps(props); - const maybeExportedObject = isElementOfType(children, ObjectView) - ? children.props.object - : null; + const isObjectView = isElementOfType(children, ObjectView); + + const maybeExportedObject = isObjectView ? children.props.object : null; const { data: table } = usePromiseFactory(fetchReexportedTable, [ maybeExportedObject, ]); - if (isElementOfType(children, ObjectView)) { + useTableClose(table); + + if (isObjectView) { // eslint-disable-next-line react/jsx-props-no-spreading return table && ; }