Skip to content

Commit 10e4036

Browse files
committed
Temp IDs for input filters
1 parent 4a6a55b commit 10e4036

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
@@ -48,6 +48,7 @@ import UITableContextMenuHandler, {
4848
} from './UITableContextMenuHandler';
4949
import UITableModel, { makeUiTableModel } from './UITableModel';
5050
import { UITableLayoutHints } from './JsTableProxy';
51+
import { nanoid } from 'nanoid';
5152

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

@@ -147,7 +148,7 @@ function useUITableModel({
147148
return model;
148149
}
149150

150-
export function UITable({
151+
export function UITableInner({
151152
format_: formatProp = EMPTY_ARRAY as unknown as FormattingRule[],
152153
onCellPress,
153154
onCellDoublePress,
@@ -550,4 +551,9 @@ export function UITable({
550551

551552
UITable.displayName = 'TableElementView';
552553

554+
export function UITable(props: UITableProps): JSX.Element {
555+
const [__dhId] = useState(() => nanoid());
556+
return <UITableInner {...props} __dhId={__dhId} />;
557+
}
558+
553559
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
@@ -10,7 +10,7 @@ import { nanoid } from 'nanoid';
1010
import {
1111
LayoutUtils,
1212
PanelEvent,
13-
PanelIdContext,
13+
DhIdContext,
1414
useLayoutManager,
1515
useListener,
1616
} from '@deephaven/dashboard';
@@ -219,7 +219,7 @@ function ReactPanel({
219219
return portal
220220
? ReactDOM.createPortal(
221221
<ReactPanelContext.Provider value={panelId}>
222-
<PanelIdContext.Provider value={panelId}>
222+
<DhIdContext.Provider value={panelId}>
223223
<View
224224
height="100%"
225225
width="100%"
@@ -264,7 +264,7 @@ function ReactPanel({
264264
</ReactPanelErrorBoundary>
265265
</Flex>
266266
</View>
267-
</PanelIdContext.Provider>
267+
</DhIdContext.Provider>
268268
</ReactPanelContext.Provider>,
269269
portal,
270270
contentKey

0 commit comments

Comments
 (0)