File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import React , { useCallback , useMemo } from 'react' ;
1+ import React , { useCallback , useMemo , useState } from 'react' ;
22import Log from '@deephaven/log' ;
33import { isWidgetPlugin , usePlugins } from '@deephaven/plugin' ;
44import type { dh } from '@deephaven/jsapi-types' ;
5+ import { nanoid } from 'nanoid' ;
56
67const 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 ) ;
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ import UITableContextMenuHandler, {
3838} from './UITableContextMenuHandler' ;
3939import UITableModel , { makeUiTableModel } from './UITableModel' ;
4040import { UITableLayoutHints } from './JsTableProxy' ;
41+ import { nanoid } from 'nanoid' ;
4142
4243const 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
478479UITable . displayName = 'TableElementView' ;
479480
481+ export function UITable ( props : UITableProps ) : JSX . Element {
482+ const [ __dhId ] = useState ( ( ) => nanoid ( ) ) ;
483+ return < UITableInner { ...props } __dhId = { __dhId } /> ;
484+ }
485+
480486export default UITable ;
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { nanoid } from 'nanoid';
44import {
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
You can’t perform that action at this time.
0 commit comments