Skip to content

Commit cbae21c

Browse files
committed
Temp IDs for input filters
1 parent 52afd03 commit cbae21c

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

plugins/ui/src/js/src/elements/ObjectView.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import React, { useCallback, useMemo } from 'react';
1+
import React, { useCallback, useMemo, useState } from 'react';
22
import Log from '@deephaven/log';
33
import { isWidgetPlugin, usePlugins } from '@deephaven/plugin';
44
import type { dh } from '@deephaven/jsapi-types';
5+
import { nanoid } from 'nanoid';
56

67
const log = Log.module('@deephaven/js-plugin-ui/ObjectView');
78

@@ -10,6 +11,7 @@ function ObjectView(props: ObjectViewProps): JSX.Element {
1011
const { object } = props;
1112
log.info('Object is', object);
1213
const { type } = object;
14+
const [__dhId] = useState(() => nanoid());
1315

1416
const fetch = useCallback(async () => {
1517
// We re-export the object in case this object is used in multiple places or closed/opened multiple times
@@ -32,7 +34,7 @@ function ObjectView(props: ObjectViewProps): JSX.Element {
3234
if (plugin != null) {
3335
const Component = plugin.component;
3436
// eslint-disable-next-line react/jsx-props-no-spreading
35-
return <Component {...props} fetch={fetch} />;
37+
return <Component {...props} fetch={fetch} __dhId={__dhId} />;
3638
}
3739

3840
log.warn('Unknown object type', object.type);

plugins/ui/src/js/src/elements/UITable/UITable.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import UITableContextMenuHandler, {
3838
} from './UITableContextMenuHandler';
3939
import UITableModel, { makeUiTableModel } from './UITableModel';
4040
import { UITableLayoutHints } from './JsTableProxy';
41+
import { nanoid } from 'nanoid';
4142

4243
const log = Log.module('@deephaven/js-plugin-ui/UITable');
4344

@@ -137,7 +138,7 @@ function useUITableModel({
137138
return model;
138139
}
139140

140-
export function UITable({
141+
export function UITableInner({
141142
format_: formatProp = EMPTY_ARRAY as unknown as FormattingRule[],
142143
onCellPress,
143144
onCellDoublePress,
@@ -477,4 +478,9 @@ export function UITable({
477478

478479
UITable.displayName = 'TableElementView';
479480

481+
export function UITable(props: UITableProps): JSX.Element {
482+
const [__dhId] = useState(() => nanoid());
483+
return <UITableInner {...props} __dhId={__dhId} />;
484+
}
485+
480486
export default UITable;

plugins/ui/src/js/src/layout/ReactPanel.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { nanoid } from 'nanoid';
44
import {
55
LayoutUtils,
66
PanelEvent,
7-
PanelIdContext,
7+
DhIdContext,
88
useLayoutManager,
99
useListener,
1010
} from '@deephaven/dashboard';
@@ -205,7 +205,7 @@ function ReactPanel({
205205
return portal
206206
? ReactDOM.createPortal(
207207
<ReactPanelContext.Provider value={panelId}>
208-
<PanelIdContext.Provider value={panelId}>
208+
<DhIdContext.Provider value={panelId}>
209209
<View
210210
height="100%"
211211
width="100%"
@@ -245,7 +245,7 @@ function ReactPanel({
245245
</ReactPanelErrorBoundary>
246246
</Flex>
247247
</View>
248-
</PanelIdContext.Provider>
248+
</DhIdContext.Provider>
249249
</ReactPanelContext.Provider>,
250250
portal,
251251
contentKey

0 commit comments

Comments
 (0)