Skip to content

Commit 38e6b49

Browse files
committed
feat(react): drop support for v16 and v17
Redux v9 only support React v18. BREAKING CHANGE: drop support for v16 and v17
1 parent c83cb54 commit 38e6b49

File tree

29 files changed

+20
-319
lines changed

29 files changed

+20
-319
lines changed

.circleci/config.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ jobs:
4949
- image: cimg/node:20.11.1-browsers
5050
working_directory: ~/repo
5151
resource_class: medium+
52-
parameters:
53-
react-major-version:
54-
type: string
5552
steps:
5653
- checkout
5754
- pnpm_setup
@@ -60,7 +57,6 @@ jobs:
6057
command: pnpm test
6158
environment:
6259
JEST_JUNIT_OUTPUT: 'test-reports/junit/js-test-results.xml'
63-
REACT_MAJOR_VERSION: << parameters.react-major-version >>
6460

6561
- store_test_results:
6662
path: test-reports/junit
@@ -143,9 +139,6 @@ workflows:
143139
requires:
144140
- install
145141
- test-unit:
146-
matrix:
147-
parameters:
148-
react-major-version: ['16', '17', '18']
149142
requires:
150143
- install
151144
- test-bundle:

.eslintrc.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,6 @@ module.exports = {
152152
'react/forbid-prop-types': 'off',
153153
// Allowing the non function setState approach
154154
'react/no-access-state-in-setstate': 'off',
155-
// Causes error suggesting we replace `hydrate` with `hydrateRoot`, which would break tests with React 16 and 17
156-
'react/no-deprecated': 'off',
157155
// Opting out of this
158156
'react/destructuring-assignment': 'off',
159157
// Adding 'skipShapeProps' as the rule has issues with correctly handling PropTypes.shape

csp-server/client.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { hydrate } from 'react-dom';
2+
import { hydrateRoot } from 'react-dom/client';
33
import App from './app';
44

55
const root = document.getElementById('root');
@@ -12,5 +12,5 @@ if (cspEl) {
1212
}
1313

1414
if (root) {
15-
hydrate(<App nonce={nonce} />, root);
15+
hydrateRoot(root, <App nonce={nonce} />);
1616
}

csp-server/environment.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
interface ProcessEnv {
22
NODE_ENV?: 'development' | 'production';
3-
REACT_MAJOR_VERSION?: '16' | '17' | '18';
43
CI?: boolean;
54
}
65

csp-server/server.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
import express from 'express';
22
import React from 'react';
33
import { renderToString } from 'react-dom/server';
4-
import { resetServerContext } from '@hello-pangea/dnd';
54
import { resolve } from 'path';
65
import App from './app';
7-
import invokeOnReactVersion from '../test/util/invoke-on-react-version';
86

97
let count = 0;
108
function getNonce(): string {
119
return `ThisShouldBeACryptographicallySecurePseudoRandomNumber-${count++}`;
1210
}
1311

1412
function renderHtml(policy?: string, nonce?: string) {
15-
invokeOnReactVersion(['16', '17'], resetServerContext);
16-
1713
let meta = '';
1814
if (nonce) {
1915
meta += `<meta id="csp-nonce" property="csp-nonce" content="${nonce}" />`;

docs/guides/common-setup-issues.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ For detectable setup issues we try to log information in the `console` for `deve
88

99
## React version
1010

11-
Please ensure that you meet our peer dependency version of `React`. Your React version needs to be greater than or equal to `16.8.5`.
11+
Please ensure that you meet our peer dependency version of `React`. Your React version needs to be greater than or equal to `18.0.0`.
1212

1313
If you want to know what React version you are on take a look at your [`package.json`](https://docs.npmjs.com/files/package.json) or use `console.log(React.version)`.
1414

15-
If you are not sure if your `package.json` version satisfies `16.8.5` have a read of [npm: about semantic versioning](https://docs.npmjs.com/about-semantic-versioning) and try out the [npm sermver calculator](https://semver.npmjs.com/)
15+
If you are not sure if your `package.json` version satisfies `18.0.0` have a read of [npm: about semantic versioning](https://docs.npmjs.com/about-semantic-versioning) and try out the [npm sermver calculator](https://semver.npmjs.com/)
1616

1717
## No duplicate ids
1818

jest.config.ts

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,15 @@
22
/// <reference path="./test/typings/environment.d.ts" />
33

44
import type { Config } from 'jest';
5-
import getReactMajorVersion from './test/util/get-react-major-version';
65
import isRunningInCI from './test/util/is-running-in-ci';
76

8-
const reactMajorVersion = getReactMajorVersion();
9-
107
const config: Config = {
118
clearMocks: true,
129
modulePathIgnorePatterns: ['/dist/'],
1310
resetMocks: true,
1411
resetModules: true,
1512
restoreMocks: true,
1613

17-
// We need a `snapshotResolver` because we run our tests
18-
// for different react versions. Each version render components
19-
// differently thus returning a different snapshot. We'll store
20-
// each snapshot in different folders:
21-
// __react_16_snapshots__, __react_17_snapshots__, etc.
22-
snapshotResolver: '<rootDir>/test/setup/snapshot-resolver.ts',
2314
setupFiles: ['./test/setup/env-setup.ts'],
2415
setupFilesAfterEnv: ['./test/setup/test-setup.ts'],
2516
testEnvironment: './test/setup/environment.ts',
@@ -35,31 +26,6 @@ const config: Config = {
3526
],
3627
};
3728

38-
// eslint-disable-next-line no-console
39-
console.log('Testing with React version:', `${reactMajorVersion}.x.x`);
40-
41-
if (['16', '17'].includes(reactMajorVersion)) {
42-
config.testPathIgnorePatterns = [
43-
...(config.testPathIgnorePatterns || []),
44-
// These test do not requires react and will
45-
// be run in the base run (with react v18)
46-
'test/unit/docs',
47-
'test/unit/health',
48-
];
49-
config.cacheDirectory = `.cache/jest-cache-react-${reactMajorVersion}`;
50-
config.moduleNameMapper = {
51-
'^@testing-library/react((\\/.*)?)$': `@testing-library/react-16-17$1`,
52-
'^react-dom((\\/.*)?)$': `react-dom-${reactMajorVersion}$1`,
53-
'^react((\\/.*)?)$': `react-${reactMajorVersion}$1`,
54-
};
55-
} else {
56-
config.testPathIgnorePatterns = [
57-
...(config.testPathIgnorePatterns || []),
58-
// resetServerContext is irrelevant from 18 onwards
59-
'test/unit/integration/drag-drop-context/reset-server-context.spec.tsx',
60-
];
61-
}
62-
6329
if (isRunningInCI()) {
6430
config.maxWorkers = 2;
6531
}

package.json

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@
4949
"release:test": "release-it --dry-run",
5050
"test:accessibility": "lighthouse http://localhost:9002/iframe.html?id=examples-single-vertical-list--basic --no-enable-error-reporting --config-path=lighthouse.config.js --chrome-flags='--headless' --output=json --output=html --output-path=./test-reports/lighthouse/a11y.json && node a11y-audit-parse.js",
5151
"test": "jest --config ./jest.config.ts",
52-
"test:react-16": "cross-env REACT_MAJOR_VERSION=16 pnpm test",
53-
"test:react-17": "cross-env REACT_MAJOR_VERSION=17 pnpm test",
54-
"test:react-18": "cross-env REACT_MAJOR_VERSION=18 pnpm test",
5552
"test:browser": "cypress open",
5653
"test:browser:ci": "cypress run",
5754
"test:coverage": "pnpm test --coverage --coveragePathIgnorePatterns=/debug",
@@ -123,7 +120,6 @@
123120
"@testing-library/dom": "9.3.4",
124121
"@testing-library/jest-dom": "6.5.0",
125122
"@testing-library/react": "14.3.1",
126-
"@testing-library/react-16-17": "npm:@testing-library/[email protected]",
127123
"@types/express": "4.17.21",
128124
"@types/fs-extra": "11.0.4",
129125
"@types/jest": "29.5.13",
@@ -181,11 +177,7 @@
181177
"prettier": "3.3.3",
182178
"raf-stub": "3.0.0",
183179
"react": "18.3.1",
184-
"react-16": "npm:[email protected]",
185-
"react-17": "npm:[email protected]",
186180
"react-dom": "18.3.1",
187-
"react-dom-16": "npm:[email protected]",
188-
"react-dom-17": "npm:[email protected]",
189181
"react-virtualized": "9.22.5",
190182
"react-window": "1.8.10",
191183
"release-it": "17.6.0",
@@ -205,8 +197,8 @@
205197
"webpack": "5.94.0"
206198
},
207199
"peerDependencies": {
208-
"react": "^16.8.5 || ^17.0.0 || ^18.0.0",
209-
"react-dom": "^16.8.5 || ^17.0.0 || ^18.0.0"
200+
"react": "^18.0.0",
201+
"react-dom": "^18.0.0"
210202
},
211203
"license": "Apache-2.0",
212204
"jest-junit": {

renovate.json5

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,5 @@
3939
rangeStrategy: "widen",
4040
commitMessagePrefix: "chore(peer-deps):",
4141
},
42-
43-
// to support previous react version
44-
{
45-
"matchPackageNames": ["@testing-library/react-16-17"],
46-
"allowedVersions": "<13.0.0",
47-
},
48-
{
49-
"matchPackageNames": ["react-16", "react-dom-16"],
50-
"allowedVersions": "<17.0.0",
51-
},
52-
{
53-
"matchPackageNames": ["react-17", "react-dom-17"],
54-
"allowedVersions": "<18.0.0",
55-
},
5642
],
5743
}

src/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,3 @@ export {
6262
useTouchSensor,
6363
useKeyboardSensor,
6464
} from './view/use-sensor-marshal';
65-
66-
// Utils
67-
export { resetServerContext } from './view/drag-drop-context';

0 commit comments

Comments
 (0)