Skip to content

Commit 8e2a9d6

Browse files
Make React 19 the default version for development (#12177)
Co-authored-by: jerelmiller <jerelmiller@users.noreply.github.com> Co-authored-by: Lenz Weber-Tronic <lorenz.weber-tronic@apollographql.com>
1 parent 95e613e commit 8e2a9d6

14 files changed

+126
-139
lines changed

.size-limits.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"dist/apollo-client.min.cjs": 41613,
2+
"dist/apollo-client.min.cjs": 41615,
33
"import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 34349
44
}

config/jest.config.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,17 @@ const standardReact19Config = {
6363
...defaults,
6464
displayName: "ReactDOM 19",
6565
testPathIgnorePatterns: react19TestFileIgnoreList,
66-
moduleNameMapper: {
67-
"^react$": "react-19",
68-
"^react-dom$": "react-dom-19",
69-
"^react-dom/(.*)$": "react-dom-19/$1",
70-
},
7166
};
7267

7368
const standardReact18Config = {
7469
...defaults,
7570
displayName: "ReactDOM 18",
7671
testPathIgnorePatterns: [ignoreTSFiles],
72+
moduleNameMapper: {
73+
"^react$": "react-18",
74+
"^react-dom$": "react-dom-18",
75+
"^react-dom/(.*)$": "react-dom-18/$1",
76+
},
7777
};
7878

7979
const standardReact17Config = {
@@ -83,6 +83,7 @@ const standardReact17Config = {
8383
moduleNameMapper: {
8484
"^react$": "react-17",
8585
"^react-dom$": "react-dom-17",
86+
"^react-dom/client$": "<rootDir>/../config/jest/react-dom-17-client.js",
8687
"^react-dom/server$": "react-dom-17/server",
8788
"^react-dom/test-utils$": "react-dom-17/test-utils",
8889
},

config/jest/react-dom-17-client.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Shim for React 17 react-dom/client entrypoint imported by React Testing
2+
// Library
3+
4+
module.exports = {
5+
hydrateRoot: () => {
6+
throw new Error(
7+
"Cannot use hydrateRoot with React 17. Ensure this uses legacy root instead"
8+
);
9+
},
10+
createRoot: () => {
11+
throw new Error(
12+
"Cannot use createRoot with React 17. Ensure this uses legacy root instead"
13+
);
14+
},
15+
};

package-lock.json

+68-96
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+10-9
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@
122122
"@size-limit/esbuild-why": "11.1.4",
123123
"@size-limit/preset-small-lib": "11.1.4",
124124
"@testing-library/dom": "^10.4.0",
125-
"@testing-library/jest-dom": "6.4.6",
126-
"@testing-library/react": "^16.0.1",
127-
"@testing-library/react-render-stream": "2.0.0-alpha.1",
125+
"@testing-library/jest-dom": "6.6.3",
126+
"@testing-library/react": "^16.1.0",
127+
"@testing-library/react-render-stream": "2.0.0",
128128
"@testing-library/user-event": "14.5.2",
129129
"@tsconfig/node20": "20.1.4",
130130
"@types/bytes": "3.1.4",
@@ -135,8 +135,9 @@
135135
"@types/lodash": "4.17.7",
136136
"@types/node": "20.16.1",
137137
"@types/node-fetch": "2.6.11",
138-
"@types/react": "18.3.3",
139-
"@types/react-dom": "18.3.0",
138+
"@types/prop-types": "^15.7.14",
139+
"@types/react": "19.0.0",
140+
"@types/react-dom": "19.0.0",
140141
"@types/relay-runtime": "14.1.24",
141142
"@types/use-sync-external-store": "0.0.6",
142143
"@typescript-eslint/eslint-plugin": "7.18.0",
@@ -168,12 +169,12 @@
168169
"patch-package": "8.0.0",
169170
"pkg-pr-new": "0.0.24",
170171
"prettier": "3.1.1",
171-
"react": "18.3.1",
172+
"react": "19.0.0",
172173
"react-17": "npm:react@^17",
173-
"react-19": "npm:react@19.0.0",
174-
"react-dom": "18.3.1",
174+
"react-18": "npm:react@^18",
175+
"react-dom": "19.0.0",
175176
"react-dom-17": "npm:react-dom@^17",
176-
"react-dom-19": "npm:react-dom@19.0.0",
177+
"react-dom-18": "npm:react-dom@^18",
177178
"react-error-boundary": "4.0.13",
178179
"recast": "0.23.9",
179180
"resolve": "1.22.8",

src/react/components/__tests__/client/Query.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ describe("Query component", () => {
210210
];
211211

212212
const Component = () => (
213-
<Query query={allPeopleQuery} data-ref={React.useRef()}>
213+
<Query query={allPeopleQuery} data-ref={React.useRef(void 0)}>
214214
{(result: any) => {
215215
if (result.loading) {
216216
return null;

0 commit comments

Comments
 (0)