Skip to content

Commit

Permalink
[Backport 15.0] Use React 19 stable (#73564)
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon authored Dec 5, 2024
1 parent 7dc7be2 commit 8774088
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 43 deletions.
4 changes: 2 additions & 2 deletions examples/reproduction-template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
},
"dependencies": {
"next": "canary",
"react": "19.0.0-rc-66855b96-20241106",
"react-dom": "19.0.0-rc-66855b96-20241106"
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@types/node": "20.12.12",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,10 @@
"pretty-bytes": "5.3.0",
"pretty-ms": "7.0.0",
"random-seed": "0.3.0",
"react": "19.0.0-rc-66855b96-20241106",
"react": "19.0.0",
"react-17": "npm:react@17.0.2",
"react-builtin": "npm:react@19.0.0-rc-66855b96-20241106",
"react-dom": "19.0.0-rc-66855b96-20241106",
"react-dom": "19.0.0",
"react-dom-17": "npm:react-dom@17.0.2",
"react-dom-builtin": "npm:react-dom@19.0.0-rc-66855b96-20241106",
"react-dom-experimental-builtin": "npm:react-dom@0.0.0-experimental-66855b96-20241106",
Expand Down
6 changes: 3 additions & 3 deletions packages/create-next-app/templates/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { GetTemplateFileArgs, InstallTemplateArgs } from "./types";

// Do not rename or format. sync-react script relies on this line.
// prettier-ignore
const nextjsReactPeerVersion = "19.0.0-rc-66855b96-20241106";
const nextjsReactPeerVersion = "^19.0.0";

/**
* Get the file path for a given file in a template, e.g. "next.config.js".
Expand Down Expand Up @@ -212,8 +212,8 @@ export const installTemplate = async ({
...packageJson.devDependencies,
typescript: "^5",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/react": "^19",
"@types/react-dom": "^19",
};
}

Expand Down
4 changes: 2 additions & 2 deletions packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@
"@opentelemetry/api": "^1.1.0",
"@playwright/test": "^1.41.2",
"babel-plugin-react-compiler": "*",
"react": "^18.2.0 || 19.0.0-rc-66855b96-20241106",
"react-dom": "^18.2.0 || 19.0.0-rc-66855b96-20241106",
"react": "^18.2.0 || 19.0.0-rc-66855b96-20241106 || ^19.0.0",
"react-dom": "^18.2.0 || 19.0.0-rc-66855b96-20241106 || ^19.0.0",
"sass": "^1.3.0"
},
"peerDependenciesMeta": {
Expand Down
2 changes: 1 addition & 1 deletion packages/third-parties/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
},
"peerDependencies": {
"next": "^13.0.0 || ^14.0.0 || ^15.0.0",
"react": "^18.2.0 || 19.0.0-rc-66855b96-20241106"
"react": "^18.2.0 || 19.0.0-rc-66855b96-20241106 || ^19.0.0"
}
}
2 changes: 1 addition & 1 deletion run-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const { getTestFilter } = require('./test/get-test-filter')

// Do not rename or format. sync-react script relies on this line.
// prettier-ignore
const nextjsReactPeerVersion = "19.0.0-rc-66855b96-20241106";
const nextjsReactPeerVersion = "^19.0.0";

let argv = require('yargs/yargs')(process.argv.slice(2))
.string('type')
Expand Down
4 changes: 2 additions & 2 deletions test/.stats-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"license": "MIT",
"dependencies": {
"next": "latest",
"react": "19.0.0-rc-66855b96-20241106",
"react-dom": "19.0.0-rc-66855b96-20241106"
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"engines": {
"node": ">=18.18.0"
Expand Down
28 changes: 3 additions & 25 deletions test/e2e/app-dir/rsc-basic/rsc-basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import cheerio from 'cheerio'
// on experimental flags. For example, as a first step we could all the common
// gates like this one into a single module.
const isPPREnabledByDefault = process.env.__NEXT_EXPERIMENTAL_PPR === 'true'
const isReact18 = parseInt(process.env.NEXT_TEST_REACT_VERSION) === 18

async function resolveStreamResponse(response: any, onData?: any) {
let result = ''
Expand Down Expand Up @@ -515,14 +514,7 @@ describe('app dir - rsc basics', () => {
]

ssrPagesReactVersions.forEach((version) => {
if (isReact18 || isPPREnabledByDefault) {
expect(version).not.toMatch(bundledReactVersionPattern)
} else {
// TODO: Pages router only supports React 19 that is bundled
// Once we run with React 19 stable, this branch should be removed in
// favor of unconditional `not.toMatch`
expect(version).toMatch(bundledReactVersionPattern)
}
expect(version).not.toMatch(bundledReactVersionPattern)
})
})
await Promise.all(promises)
Expand Down Expand Up @@ -556,24 +548,10 @@ describe('app dir - rsc basics', () => {
`)

browserPagesReactVersions.forEach((version) => {
if (isReact18 || isPPREnabledByDefault) {
expect(version).not.toMatch(bundledReactVersionPattern)
} else {
// TODO: Pages router only supports React 19 that is bundled
// Once we run with React 19 stable, this branch should be removed in
// favor of unconditional `not.toMatch`
expect(version).toMatch(bundledReactVersionPattern)
}
expect(version).not.toMatch(bundledReactVersionPattern)
})
browserEdgePagesReactVersions.forEach((version) => {
if (isReact18 || isPPREnabledByDefault) {
expect(version).not.toMatch(bundledReactVersionPattern)
} else {
// TODO: Pages router only supports React 19 that is bundled
// Once we run with React 19 stable, this branch should be removed in
// favor of unconditional `not.toMatch`
expect(version).toMatch(bundledReactVersionPattern)
}
expect(version).not.toMatch(bundledReactVersionPattern)
})
})

Expand Down
4 changes: 2 additions & 2 deletions test/e2e/next-test/first-time-setup-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"dependencies": {
"next": "canary",
"react": "19.0.0-rc-66855b96-20241106",
"react-dom": "19.0.0-rc-66855b96-20241106"
"react": "^19.0.0",
"react-dom": "^19.0.0"
}
}
4 changes: 2 additions & 2 deletions test/e2e/next-test/first-time-setup-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
},
"dependencies": {
"next": "canary",
"react": "19.0.0-rc-66855b96-20241106",
"react-dom": "19.0.0-rc-66855b96-20241106"
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@types/react": "^18",
Expand Down
2 changes: 1 addition & 1 deletion test/lib/next-modes/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type OmitFirstArgument<F> = F extends (

// Do not rename or format. sync-react script relies on this line.
// prettier-ignore
const nextjsReactPeerVersion = "19.0.0-rc-66855b96-20241106";
const nextjsReactPeerVersion = "^19.0.0";

export class NextInstance {
protected files: FileRef | { [filename: string]: string | FileRef }
Expand Down

0 comments on commit 8774088

Please sign in to comment.