Skip to content

Commit 0c61265

Browse files
wardpeetLekoArts
andauthored
fix: compatibility with react rc 2 (#35108)
Co-authored-by: Lennart <lekoarts@gmail.com>
1 parent 35c4a93 commit 0c61265

File tree

31 files changed

+195
-132
lines changed

31 files changed

+195
-132
lines changed

packages/gatsby-link/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
},
2222
"peerDependencies": {
2323
"@gatsbyjs/reach-router": "^1.3.5",
24-
"react": "^16.9.0 || ^17.0.0",
25-
"react-dom": "^16.9.0 || ^17.0.0"
24+
"react": "^16.9.0 || ^17.0.0 || ^18.0.0",
25+
"react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0"
2626
},
2727
"homepage": "https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-link#readme",
2828
"keywords": [

packages/gatsby-plugin-cxs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
"peerDependencies": {
2929
"cxs": ">=5.0.0",
3030
"gatsby": "^4.0.0-next",
31-
"react": "^16.9.0 || ^17.0.0",
32-
"react-dom": "^16.9.0 || ^17.0.0"
31+
"react": "^16.9.0 || ^17.0.0 || ^18.0.0",
32+
"react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0"
3333
},
3434
"repository": {
3535
"type": "git",

packages/gatsby-plugin-feed/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
"main": "index.js",
3434
"peerDependencies": {
3535
"gatsby": "^4.0.0-next",
36-
"react": "^16.9.0 || ^17.0.0",
37-
"react-dom": "^16.9.0 || ^17.0.0"
36+
"react": "^16.9.0 || ^17.0.0 || ^18.0.0",
37+
"react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0"
3838
},
3939
"repository": {
4040
"type": "git",

packages/gatsby-plugin-fullstory/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
},
3535
"peerDependencies": {
3636
"gatsby": "^4.0.0-next",
37-
"react": "^16.9.0 || ^17.0.0",
38-
"react-dom": "^16.9.0 || ^17.0.0"
37+
"react": "^16.9.0 || ^17.0.0 || ^18.0.0",
38+
"react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0"
3939
},
4040
"engines": {
4141
"node": ">=14.15.0"

packages/gatsby-plugin-google-analytics/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
"main": "index.js",
2929
"peerDependencies": {
3030
"gatsby": "^4.0.0-next",
31-
"react": "^16.9.0 || ^17.0.0",
32-
"react-dom": "^16.9.0 || ^17.0.0"
31+
"react": "^16.9.0 || ^17.0.0 || ^18.0.0",
32+
"react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0"
3333
},
3434
"repository": {
3535
"type": "git",

packages/gatsby-plugin-google-gtag/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
"main": "index.js",
2828
"peerDependencies": {
2929
"gatsby": "^4.0.0-next",
30-
"react": "^16.9.0 || ^17.0.0",
31-
"react-dom": "^16.9.0 || ^17.0.0"
30+
"react": "^16.9.0 || ^17.0.0 || ^18.0.0",
31+
"react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0"
3232
},
3333
"repository": {
3434
"type": "git",

packages/gatsby-plugin-google-tagmanager/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
"main": "index.js",
2929
"peerDependencies": {
3030
"gatsby": "^4.0.0-next",
31-
"react": "^16.9.0 || ^17.0.0",
32-
"react-dom": "^16.9.0 || ^17.0.0"
31+
"react": "^16.9.0 || ^17.0.0 || ^18.0.0",
32+
"react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0"
3333
},
3434
"repository": {
3535
"type": "git",

packages/gatsby-plugin-image/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
"@types/fs-extra": "^9.0.13",
5050
"@types/node": "^14.10.2",
5151
"@types/prop-types": "^15.7.3",
52-
"@types/react": "^16.9.56",
53-
"@types/react-dom": "^16.9.8",
52+
"@types/react": "^17.0.40",
53+
"@types/react-dom": "^17.0.13",
5454
"ast-pretty-print": "^2.0.1",
5555
"babel-plugin-macros": "^2.8.0",
5656
"cross-env": "^7.0.3",
@@ -60,6 +60,7 @@
6060
"microbundle": "^0.13.0",
6161
"npm-run-all": "^4.1.5",
6262
"postcss": "^8.2.9",
63+
"semver": "^7.0.0",
6364
"terser": "^5.3.8",
6465
"typescript": "^4.5.5"
6566
},
@@ -68,8 +69,8 @@
6869
"gatsby": "^4.0.0-next",
6970
"gatsby-plugin-sharp": "^4.0.0-next",
7071
"gatsby-source-filesystem": "^4.0.0-next",
71-
"react": "^16.9.0 || ^17.0.0",
72-
"react-dom": "^16.9.0 || ^17.0.0"
72+
"react": "^16.9.0 || ^17.0.0 || ^18.0.0",
73+
"react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0"
7374
},
7475
"dependencies": {
7576
"@babel/code-frame": "^7.14.0",

packages/gatsby-plugin-image/src/components/__tests__/gatsby-image.browser.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
*/
44

55
import React from "react"
6-
import { GatsbyImage, IGatsbyImageData } from "../gatsby-image.browser"
76
import { render, waitFor } from "@testing-library/react"
87
import * as hooks from "../hooks"
8+
import type { IGatsbyImageData } from "../gatsby-image.browser"
99

1010
// Prevents terser for bailing because we're not in a babel plugin
1111
jest.mock(
@@ -20,15 +20,16 @@ jest.mock(
2020
describe(`GatsbyImage browser`, () => {
2121
let beforeHydrationContent: HTMLDivElement
2222
let image: IGatsbyImageData
23+
let GatsbyImage
2324

2425
beforeEach(() => {
2526
console.warn = jest.fn()
2627
console.error = jest.fn()
2728
global.SERVER = true
2829
global.GATSBY___IMAGE = true
29-
})
30+
global.HAS_REACT_18 = false
3031

31-
beforeEach(() => {
32+
GatsbyImage = require(`../gatsby-image.browser`).GatsbyImage
3233
image = {
3334
width: 100,
3435
height: 100,
@@ -80,6 +81,7 @@ describe(`GatsbyImage browser`, () => {
8081
jest.clearAllMocks()
8182
global.SERVER = undefined
8283
global.GATSBY___IMAGE = undefined
84+
global.HAS_REACT_18 = undefined
8385
process.env.NODE_ENV = `test`
8486
})
8587

packages/gatsby-plugin-image/src/components/__tests__/hooks.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
import { Node } from "gatsby"
2-
import {
3-
getSrc,
4-
getSrcSet,
5-
getImage,
6-
IGatsbyImageData,
7-
IGetImageDataArgs,
8-
} from "../../"
9-
import { getImageData } from "../hooks"
2+
import { getImageData, getSrc, getSrcSet, getImage } from "../hooks"
3+
import type { IGatsbyImageData, IGetImageDataArgs } from "../../"
104

115
const imageData: IGatsbyImageData = {
126
images: {

0 commit comments

Comments
 (0)