Skip to content

Commit b68d332

Browse files
committed
Upgrade to React 18
1 parent 7c2b7d5 commit b68d332

File tree

16 files changed

+163
-244
lines changed

16 files changed

+163
-244
lines changed

index.jsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ limitations under the License.
1313
/* istanbul ignore file */
1414

1515
import { StrictMode } from 'react';
16-
import ReactDOM from 'react-dom';
16+
import { createRoot } from 'react-dom/client';
1717
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
1818

1919
import { defaultQueryFn } from './src/api/utils';
@@ -23,7 +23,7 @@ import App from './src/containers/App';
2323
const queryClient = new QueryClient({
2424
defaultOptions: {
2525
queries: {
26-
cacheTime: 1000 * 60 * 5, // 5 minutes
26+
gcTime: 1000 * 60 * 5, // 5 minutes
2727
queryFn: defaultQueryFn,
2828
refetchOnWindowFocus: false,
2929
retry: false,
@@ -34,11 +34,12 @@ const queryClient = new QueryClient({
3434

3535
setTheme();
3636

37-
ReactDOM.render(
37+
const domNode = document.getElementById('root');
38+
const root = createRoot(domNode);
39+
root.render(
3840
<QueryClientProvider client={queryClient}>
3941
<StrictMode>
4042
<App />
4143
</StrictMode>
42-
</QueryClientProvider>,
43-
document.getElementById('root')
44+
</QueryClientProvider>
4445
);

package-lock.json

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

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@
2828
"dependencies": {
2929
"@carbon/react": "^1.86.0",
3030
"@codemirror/legacy-modes": "^6.5.2",
31-
"@tanstack/react-query": "^4.41.0",
31+
"@tanstack/react-query": "^5.90.2",
3232
"@tektoncd/dashboard-components": "*",
3333
"@tektoncd/dashboard-utils": "*",
34+
"@testing-library/dom": "^10.4.1",
3435
"@uiw/react-codemirror": "^4.25.2",
3536
"git-url-parse": "^16.1.0",
3637
"prop-types": "^15.7.2",
37-
"react": "^17.0.2",
38-
"react-dom": "^17.0.2",
38+
"react": "^18.3.1",
39+
"react-dom": "^18.3.1",
3940
"react-intl": "^7.1.13",
4041
"react-is": "^18.3.1",
4142
"react-router-dom": "^6.30.1",
@@ -49,8 +50,7 @@
4950
"@storybook/addon-links": "^9.1.10",
5051
"@storybook/addon-themes": "^9.1.10",
5152
"@storybook/react-vite": "^9.1.10",
52-
"@testing-library/react": "^12.1.5",
53-
"@testing-library/react-hooks": "^8.0.1",
53+
"@testing-library/react": "^16.3.0",
5454
"@vitejs/plugin-react-swc": "^4.1.0",
5555
"@vitest/coverage-istanbul": "^3.2.4",
5656
"dotenv": "^17.2.3",

packages/components/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
},
3030
"peerDependencies": {
3131
"@carbon/react": "^1.65.0",
32-
"react": "^16.14.0 || ^17.0.2",
33-
"react-dom": "^16.14.0 || ^17.0.2",
32+
"react": "^16.14.0 || ^17.0.2 || ^18.3.0",
33+
"react-dom": "^16.14.0 || ^17.0.2 || ^18.3.0",
3434
"react-intl": "^7.0.1",
3535
"react-router-dom": "^5.0.0 || ^6.0.0"
3636
},

packages/graph/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
},
3131
"peerDependencies": {
3232
"@carbon/react": "^1.68.0",
33-
"react": "^16.14.0 || ^17.0.2",
33+
"react": "^16.14.0 || ^17.0.2 || ^18.3.0",
3434
"react-intl": "^7.0.1"
3535
},
3636
"engines": {

packages/utils/src/utils/hooks.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2021-2023 The Tekton Authors
2+
Copyright 2021-2025 The Tekton Authors
33
Licensed under the Apache License, Version 2.0 (the "License");
44
you may not use this file except in compliance with the License.
55
You may obtain a copy of the License at
@@ -11,7 +11,7 @@ See the License for the specific language governing permissions and
1111
limitations under the License.
1212
*/
1313

14-
import { renderHook } from '@testing-library/react-hooks';
14+
import { renderHook } from '@testing-library/react';
1515

1616
import { usePrevious, useWebSocketReconnected } from './hooks';
1717

src/api/index.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ See the License for the specific language governing permissions and
1111
limitations under the License.
1212
*/
1313

14-
import { renderHook } from '@testing-library/react-hooks';
14+
import { renderHook } from '@testing-library/react';
1515
import { labels } from '@tektoncd/dashboard-utils';
1616
import { http, HttpResponse } from 'msw';
1717

src/api/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ function getResourceVersion(resource) {
121121
}
122122

123123
function handleCreated({ group, kind, payload: _, queryClient, version }) {
124-
queryClient.invalidateQueries([group, version, kind]);
124+
queryClient.invalidateQueries({ queryKey: [group, version, kind] });
125125
}
126126

127127
function handleDeleted({ group, kind, payload, queryClient, version }) {
@@ -196,7 +196,7 @@ export function useWebSocket({
196196

197197
useEffect(() => {
198198
if (enabled === false) {
199-
return null;
199+
return;
200200
}
201201

202202
function handleClose() {

src/api/utils.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019-2024 The Tekton Authors
2+
Copyright 2019-2025 The Tekton Authors
33
Licensed under the Apache License, Version 2.0 (the "License");
44
you may not use this file except in compliance with the License.
55
You may obtain a copy of the License at
@@ -11,7 +11,7 @@ See the License for the specific language governing permissions and
1111
limitations under the License.
1212
*/
1313

14-
import { act, renderHook } from '@testing-library/react-hooks';
14+
import { act, renderHook } from '@testing-library/react';
1515

1616
import * as comms from './comms';
1717
import * as utils from './utils';

src/containers/CreateCustomRun/CreateCustomRun.test.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ describe('CreateCustomRun yaml mode', () => {
9898
}
9999
);
100100
await waitFor(() => {
101-
expect(getByRole(/textbox/)).toBeTruthy();
101+
expect(getByRole('textbox')).toBeTruthy();
102102
});
103-
let actual = getByRole(/textbox/).textContent;
103+
let actual = getByRole('textbox').textContent;
104104
actual = actual.replace(findNameRegexp, 'name: run-1111111111');
105105
expect(actual.trim()).toEqual(expectedCustomRunOneLine);
106106
});

0 commit comments

Comments
 (0)