Skip to content

Commit 45cf06a

Browse files
committed
Update to beta packages
1 parent 0cd97d8 commit 45cf06a

7 files changed

Lines changed: 471 additions & 190 deletions

File tree

package-lock.json

Lines changed: 397 additions & 125 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/ui/src/js/package.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,25 @@
4040
"react-dom": "^17.0.2"
4141
},
4242
"dependencies": {
43-
"@deephaven/chart": "^0.106.2",
44-
"@deephaven/components": "^0.106.2",
45-
"@deephaven/console": "^0.106.3",
46-
"@deephaven/dashboard": "^0.106.4",
47-
"@deephaven/dashboard-core-plugins": "^0.106.4",
48-
"@deephaven/golden-layout": "^0.106.2",
49-
"@deephaven/grid": "^0.106.3",
50-
"@deephaven/icons": "^0.106.0",
51-
"@deephaven/iris-grid": "^0.106.4",
52-
"@deephaven/jsapi-bootstrap": "^0.106.2",
53-
"@deephaven/jsapi-components": "^0.106.2",
43+
"@deephaven/chart": "0.108.1-beta.1",
44+
"@deephaven/components": "0.108.1-beta.1",
45+
"@deephaven/console": "0.108.1-beta.1",
46+
"@deephaven/dashboard": "0.108.1-beta.1",
47+
"@deephaven/dashboard-core-plugins": "0.108.1-beta.1",
48+
"@deephaven/golden-layout": "0.108.1-beta.1",
49+
"@deephaven/grid": "0.108.1-beta.1",
50+
"@deephaven/icons": "0.108.1-beta.1",
51+
"@deephaven/iris-grid": "0.108.1-beta.1",
52+
"@deephaven/jsapi-bootstrap": "0.108.1-beta.1",
53+
"@deephaven/jsapi-components": "0.108.1-beta.1",
5454
"@deephaven/jsapi-types": "^1.0.0-dev0.35.0",
55-
"@deephaven/jsapi-utils": "^0.106.2",
56-
"@deephaven/log": "^0.106.2",
57-
"@deephaven/plugin": "^0.106.4",
58-
"@deephaven/react-hooks": "^0.106.2",
59-
"@deephaven/redux": "^0.106.4",
60-
"@deephaven/test-utils": "^0.106.0",
61-
"@deephaven/utils": "^0.106.0",
55+
"@deephaven/jsapi-utils": "0.108.1-beta.1",
56+
"@deephaven/log": "0.108.1-beta.1",
57+
"@deephaven/plugin": "0.108.1-beta.1",
58+
"@deephaven/react-hooks": "0.108.1-beta.1",
59+
"@deephaven/redux": "0.108.1-beta.1",
60+
"@deephaven/test-utils": "0.108.1-beta.1",
61+
"@deephaven/utils": "0.108.1-beta.1",
6262
"@fortawesome/react-fontawesome": "^0.2.0",
6363
"@internationalized/date": "^3.5.5",
6464
"classnames": "^2.5.1",

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

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import {
2828
viewStyleProps,
2929
} from '@deephaven/components';
3030
import { useApi } from '@deephaven/jsapi-bootstrap';
31-
import { TableUtils } from '@deephaven/jsapi-utils';
3231
import type { dh as DhType } from '@deephaven/jsapi-types';
3332
import Log from '@deephaven/log';
3433
import { getSettings, RootState } from '@deephaven/redux';
@@ -441,17 +440,15 @@ export function UITable({
441440
[contextMenu, alwaysFetchColumns]
442441
);
443442

444-
const irisGridProps = useMemo(() => {
443+
const irisGridServerProps = useMemo(() => {
445444
const props = {
446445
mouseHandlers,
447446
alwaysFetchColumns,
448447
showSearchBar,
449448
sorts: hydratedSorts,
450449
quickFilters: hydratedQuickFilters,
451450
isFilterBarShown: showQuickFilters,
452-
reverseType: reverse
453-
? TableUtils.REVERSE_TYPE.POST_SORT
454-
: TableUtils.REVERSE_TYPE.NONE,
451+
reverse,
455452
density,
456453
settings: { ...settings, showExtraGroupColumn: showGroupingColumn },
457454
onContextMenu,
@@ -478,8 +475,13 @@ export function UITable({
478475
},
479476
} satisfies Partial<IrisGridProps>;
480477

481-
// Remove any explicit undefined values
482-
Object.entries(props).forEach(([key, value]) => {
478+
// Remove any explicit undefined values so we can use client state if available
479+
(
480+
Object.entries(props) as [
481+
keyof typeof props,
482+
(typeof props)[keyof typeof props],
483+
][]
484+
).forEach(([key, value]) => {
483485
if (value === undefined) {
484486
delete props[key];
485487
}
@@ -502,6 +504,29 @@ export function UITable({
502504
aggregationsPosition,
503505
]);
504506

507+
const initialIrisGridServerProps = useRef(irisGridServerProps);
508+
509+
/**
510+
* We want to set the props based on a combination of server state and client state.
511+
* If the server state is the same as its initial state, then we are rehydrating and
512+
* the client state should take precedence.
513+
* Otherwise, we have received changes from the server and we should use those over client state.
514+
* In the future we may want to do a smarter merge of these.
515+
*/
516+
const mergedIrisGridProps = useMemo(() => {
517+
if (initialIrisGridServerProps.current === irisGridServerProps) {
518+
return {
519+
...irisGridServerProps,
520+
...initialHydratedState,
521+
};
522+
}
523+
524+
return {
525+
...initialHydratedState,
526+
...irisGridServerProps,
527+
};
528+
}, [irisGridServerProps, initialHydratedState]);
529+
505530
return model ? (
506531
<div
507532
// eslint-disable-next-line react/jsx-props-no-spreading
@@ -513,9 +538,7 @@ export function UITable({
513538
model={model}
514539
onStateChange={onStateChange}
515540
// eslint-disable-next-line react/jsx-props-no-spreading
516-
{...initialHydratedState}
517-
// eslint-disable-next-line react/jsx-props-no-spreading
518-
{...irisGridProps}
541+
{...mergedIrisGridProps}
519542
/>
520543
</div>
521544
) : null;

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ function makeReactPanelManager({
3434
onClose = jest.fn(),
3535
onOpen = jest.fn(),
3636
getPanelId = jest.fn(() => mockPanelId),
37+
onDataChange = jest.fn(),
38+
getInitialData = jest.fn(() => []),
3739
title = 'test title',
3840
}: Partial<ReactPanelProps> & Partial<ReactPanelManager> = {}) {
3941
return (
@@ -43,6 +45,8 @@ function makeReactPanelManager({
4345
metadata,
4446
onClose,
4547
onOpen,
48+
onDataChange,
49+
getInitialData,
4650
}}
4751
>
4852
<ReactPanel title={title}>{children}</ReactPanel>

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
import React, {
2-
useCallback,
3-
useEffect,
4-
useMemo,
5-
useRef,
6-
useState,
7-
} from 'react';
1+
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
82
import ReactDOM from 'react-dom';
93
import { nanoid } from 'nanoid';
104
import {

plugins/ui/src/js/src/layout/ReactPanelManager.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,18 @@ export interface ReactPanelManager {
1919
/** Triggered when a panel is closed */
2020
onClose: (panelId: string) => void;
2121

22+
/**
23+
* Must be called when client data that should be persisted is changed.
24+
* @param panelId The panelId for the changed data
25+
* @param data The data to persist. Must be JSON serializable.
26+
*/
2227
onDataChange: (panelId: string, data: unknown[]) => void;
2328

29+
/**
30+
* Gets the initial persisted data for a panel.
31+
* @param panelId The panelId for the data to be retrieved.
32+
* @returns Data that was persisted for the panelId.
33+
*/
2434
getInitialData: (panelId: string) => unknown[];
2535

2636
/**
@@ -44,8 +54,16 @@ export interface ReactPanelControl {
4454
/** Must be called when the panel is closed */
4555
onClose: () => void;
4656

57+
/**
58+
* Must be called when client data that should be persisted is changed.
59+
* @param data The data to persist. Must be JSON serializable.
60+
*/
4761
onDataChange: (data: unknown[]) => void;
4862

63+
/**
64+
* Gets the initial persisted data for a panel.
65+
* @returns Data that was persisted for the panel.
66+
*/
4967
getInitialData: () => unknown[];
5068

5169
/** The panelId for this react panel */

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

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)