Skip to content

Commit b369a51

Browse files
mattrunyongzh2003
andauthored
feat: Upgrade to React 18 (#2527)
Other than upgrading to React 18, also did the following - Removed `prop-types` almost everywhere. There is 1 exported `prop-types` we consume in DHE, so not removing fully yet - Removed `defaultProps` on functional components. This is deprecated in 18 and removed completely in 19. We already had defaults with ES6 default params and having the `component.defaultProps` prints errors to the dev console that are annoying - Removed `react-test-renderer`. This is deprecated in 18 and removed in 19. Mainly had to update `Grid` and `IrisGrid` tests, but it was relatively minimal changes, the tests are faster, and better because they test simulated clicks instead of emitting the change events directly - Cleaned up all Jest warnings about `act` or other issues like throwing without suppressing error logs that are expected. The only output now should be about deprecated `defaultProps` on a `react-beautiful-dnd` component and `findDOMNode` being deprecated for transitions - Removed `StyleGuide.test.tsx`. We have e2e tests that are better and this unit test was causing issues with `act` because it has a bunch of lazy loaded components Jest can't resolve without changing the import map - Fixed some types in `IrisGrid` around props and state that were incorrect - Modified some e2e tests to be a bit more robust with the state batching --------- Co-authored-by: gzh2003 <germainzhanghoule@deephaven.io>
1 parent 9cd6593 commit b369a51

266 files changed

Lines changed: 17538 additions & 38433 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package-lock.json

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

package.json

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656
},
5757
"repository": "https://github.com/deephaven/web-client-ui",
5858
"devDependencies": {
59-
"@babel/cli": "7.20.7",
60-
"@babel/core": "7.20.12",
59+
"@babel/cli": "7.22.15",
60+
"@babel/core": "7.22.20",
6161
"@deephaven/components": "file:../components",
6262
"@deephaven/console": "file:../console",
6363
"@deephaven/eslint-config": "file:../eslint-config",
@@ -74,8 +74,7 @@
7474
"@fortawesome/fontawesome-common-types": "^6.1.1",
7575
"@playwright/test": "1.44.0",
7676
"@testing-library/jest-dom": "^5.16.4",
77-
"@testing-library/react": "^12.1.3",
78-
"@testing-library/react-hooks": "^8.0.1",
77+
"@testing-library/react": "^16.3.0",
7978
"@testing-library/user-event": "^14.4.3",
8079
"@types/bootstrap": "^4.4.1",
8180
"@types/color-convert": "^2.0.0",
@@ -95,14 +94,12 @@
9594
"@types/papaparse": "5.3.2",
9695
"@types/plotly.js": "^3.0.0",
9796
"@types/pouchdb-browser": "^6.1.3",
98-
"@types/prop-types": "^15.7.3",
99-
"@types/react": "^17.0.2",
97+
"@types/react": "^18.3.12",
10098
"@types/react-beautiful-dnd": "^13.1.2",
101-
"@types/react-dom": "^17.0.9",
102-
"@types/react-is": "^17.0.2",
99+
"@types/react-dom": "^18.3.1",
100+
"@types/react-is": "^18.3.1",
103101
"@types/react-plotly.js": "^2.6.0",
104102
"@types/react-router-dom": "^5.1.2",
105-
"@types/react-test-renderer": "^17.0.1",
106103
"@types/react-transition-group": "^4.4.0",
107104
"@types/react-virtualized-auto-sizer": "^1.0.1",
108105
"@types/react-window": "^1.8.5",
@@ -131,13 +128,12 @@
131128
"nanoid": "^5.0.7",
132129
"npm-run-all": "^4.1.5",
133130
"prettier": "3.0.0",
134-
"react": "^17.0.2",
135-
"react-dom": "^17.0.2",
136-
"react-redux": "^7.2.4",
137-
"react-test-renderer": "^17.0.2",
131+
"react": "^18.3.1",
132+
"react-dom": "^18.3.1",
133+
"react-redux": "^7.2.7",
138134
"redux": "^4.2.0",
139135
"rimraf": "^3.0.2",
140-
"sass": "^1.39.0",
136+
"sass": "1.49.9",
141137
"source-map-explorer": "^2.5.2",
142138
"stylelint": "^14.5.1",
143139
"typescript": "~5.6.2",

packages/app-utils/package.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,7 @@
2222
"build:babel": "babel ./src --out-dir ./dist --extensions \".ts,.tsx,.js,.jsx\" --source-maps --root-mode upward"
2323
},
2424
"devDependencies": {
25-
"@deephaven/test-utils": "file:../test-utils",
26-
"react": "^17.x",
27-
"react-dom": "^17.x",
28-
"react-redux": "^7.x",
29-
"redux": "^4.x"
25+
"@deephaven/test-utils": "file:../test-utils"
3026
},
3127
"dependencies": {
3228
"@adobe/react-spectrum": "3.38.0",

packages/app-utils/src/components/AppDashboards.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useCallback } from 'react';
22
import classNames from 'classnames';
33
import {
44
DashboardUtils,
5-
type DehydratedDashboardPanelProps,
5+
type DehydratedPanelProps,
66
LazyDashboard,
77
} from '@deephaven/dashboard';
88
import { useObjectFetcher } from '@deephaven/jsapi-bootstrap';
@@ -38,7 +38,7 @@ export function AppDashboards({
3838
const fetchObject = useObjectFetcher();
3939

4040
const hydratePanel = useCallback(
41-
(hydrateProps: DehydratedDashboardPanelProps, id: string) => {
41+
(hydrateProps: DehydratedPanelProps, id: string) => {
4242
const { metadata } = hydrateProps;
4343
try {
4444
if (metadata != null) {

packages/auth-plugins/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@
4545
"js-cookie": "^3.0.5"
4646
},
4747
"devDependencies": {
48-
"@deephaven/test-utils": "file:../test-utils",
49-
"@types/react": "^17.0.2"
48+
"@deephaven/test-utils": "file:../test-utils"
5049
},
5150
"peerDependencies": {
5251
"react": ">=16.8.0",

packages/auth-plugins/src/AuthPluginPsk.test.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import userEvent from '@testing-library/user-event';
55
import { ThemeProvider } from '@deephaven/components';
66
import { ApiContext, ClientContext } from '@deephaven/jsapi-bootstrap';
77
import { dh } from '@deephaven/jsapi-shim';
8-
import type { CoreClient } from '@deephaven/jsapi-types';
8+
import type { dh as DhType } from '@deephaven/jsapi-types';
99
import AuthPluginPsk from './AuthPluginPsk';
1010
import { AUTH_HANDLER_TYPE_PSK as AUTH_TYPE } from './AuthHandlerTypes';
1111
import { type AuthConfigMap } from './AuthPlugin';
@@ -54,7 +54,7 @@ function makeCoreClient() {
5454
}
5555

5656
function renderComponent(
57-
client: CoreClient = makeCoreClient(),
57+
client: DhType.CoreClient = makeCoreClient(),
5858
authConfigValues: AuthConfigMap = new Map()
5959
) {
6060
return render(
@@ -197,11 +197,9 @@ describe('component tests', () => {
197197
expectMockChild().not.toBeInTheDocument();
198198
expect(mockLogin).not.toHaveBeenCalled();
199199

200-
await act(async () => {
201-
await user.type(screen.getByRole('textbox', { name: 'Token' }), token);
202-
await user.click(screen.getByRole('button', { name: 'Login' }));
203-
await loginPromise;
204-
});
200+
await user.type(screen.getByRole('textbox', { name: 'Token' }), token);
201+
await user.click(screen.getByRole('button', { name: 'Login' }));
202+
await loginPromise;
205203

206204
expect(mockLogin).toHaveBeenCalledWith(
207205
expect.objectContaining({
@@ -228,10 +226,8 @@ describe('component tests', () => {
228226
expectInput().toBeInTheDocument();
229227
expectMockChild().not.toBeInTheDocument();
230228

231-
await act(async () => {
232-
await user.type(screen.getByRole('textbox', { name: 'Token' }), token);
233-
await user.click(screen.getByRole('button', { name: 'Login' }));
234-
});
229+
await user.type(screen.getByRole('textbox', { name: 'Token' }), token);
230+
await user.click(screen.getByRole('button', { name: 'Login' }));
235231
expect(mockLogin).toHaveBeenCalledWith(
236232
expect.objectContaining({
237233
type: AUTH_TYPE,

packages/auth-plugins/src/__mocks__/react-transition-group.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ interface TransitionProps {
55
in: boolean;
66
}
77

8-
/* eslint-disable @typescript-eslint/strict-boolean-expressions */
9-
/* eslint-disable react/prop-types */
108
export function Transition({
119
children,
1210
in: inProp,

packages/babel-preset/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"./mockCssImportPlugin": "./mockCssImportPlugin.js"
1616
},
1717
"dependencies": {
18-
"@babel/core": "^7.20.0",
18+
"@babel/core": "^7.22.0",
1919
"@babel/plugin-proposal-class-properties": "^7.18.0",
2020
"@babel/preset-env": "^7.20.0",
2121
"@babel/preset-react": "^7.18.0",

packages/chart/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@
4040
"lodash.set": "^4.3.2",
4141
"memoize-one": "^5.1.1",
4242
"memoizee": "^0.4.15",
43-
"plotly.js": "3.1.0-rc.0",
44-
"prop-types": "^15.7.2",
43+
"plotly.js": "3.1.0",
4544
"react-plotly.js": "^2.6.0"
4645
},
4746
"peerDependencies": {

packages/chart/src/Chart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ class Chart extends Component<ChartProps, ChartState> {
247247

248248
plotWrapperMerged: React.RefCallback<HTMLDivElement>;
249249

250-
columnFormats?: FormattingRule[];
250+
columnFormats?: readonly FormattingRule[];
251251

252252
dateTimeFormatterOptions?: DateTimeColumnFormatterOptions;
253253

0 commit comments

Comments
 (0)