Skip to content

Commit f55fd80

Browse files
renovate[bot]renovate-botchambo-e
authored
chore(deps): update react monorepo to v18 (major) (#689)
* chore(deps): update react monorepo to v18 * fix: upgrade packages * fix: correct tests * docs: add notice Co-authored-by: Renovate Bot <[email protected]> Co-authored-by: Emmanuel Chambon <[email protected]>
1 parent 0e36b0f commit f55fd80

File tree

12 files changed

+59
-101
lines changed

12 files changed

+59
-101
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
"@rollup/plugin-babel": "5.3.1",
1818
"@rollup/plugin-node-resolve": "13.3.0",
1919
"@testing-library/jest-dom": "5.16.4",
20-
"@testing-library/react": "12.1.5",
20+
"@testing-library/react": "13.2.0",
2121
"@testing-library/react-hooks": "8.0.0",
2222
"@types/jest": "27.5.0",
2323
"@types/node": "17.0.31",
2424
"@types/prop-types": "15.7.5",
25-
"@types/react": "17.0.45",
25+
"@types/react": "18.0.9",
2626
"@types/react-dom": "18.0.3",
2727
"builtin-modules": "3.2.0",
2828
"cross-env": "7.0.3",
@@ -36,8 +36,8 @@
3636
"lint-staged": "12.4.1",
3737
"mockdate": "3.0.5",
3838
"prettier": "2.6.2",
39-
"react": "17.0.2",
40-
"react-dom": "17.0.2",
39+
"react": "18.1.0",
40+
"react-dom": "18.1.0",
4141
"read-pkg": "7.1.0",
4242
"rollup": "2.71.1",
4343
"rollup-plugin-dts": "4.2.1",

packages/use-dataloader/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
"prop-types": "15.8.1"
2929
},
3030
"peerDependencies": {
31-
"react": "17.x"
31+
"react": "17.x || 18.x"
3232
}
3333
}

packages/use-dataloader/src/__tests__/DataLoaderProvider.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ const wrapper = ({ children }: { children: ReactNode }) => (
2020
<DataLoaderProvider>{children}</DataLoaderProvider>
2121
)
2222

23-
const wrapperWithCacheKey = ({ children }: { children?: React.ReactNode }) => (
23+
const wrapperWithCacheKey = ({ children }: { children?: ReactNode }) => (
2424
<DataLoaderProvider cacheKeyPrefix="sample">{children}</DataLoaderProvider>
2525
)
2626

2727
const wrapperWith2ConcurrentRequests = ({
2828
children,
2929
}: {
30-
children?: React.ReactNode
30+
children?: ReactNode
3131
}) => (
3232
<DataLoaderProvider maxConcurrentRequests={2}>{children}</DataLoaderProvider>
3333
)

packages/use-dataloader/src/__tests__/useDataLoader.test.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { act, renderHook } from '@testing-library/react-hooks'
2+
import { ReactNode } from 'react'
23
import DataLoaderProvider, { useDataLoaderContext } from '../DataLoaderProvider'
34
import { KEY_IS_NOT_STRING_ERROR } from '../constants'
45
import { PromiseType, UseDataLoaderConfig, UseDataLoaderResult } from '../types'
@@ -8,6 +9,7 @@ type UseDataLoaderHookProps = {
89
config: UseDataLoaderConfig<unknown>
910
key: string
1011
method: () => Promise<unknown>
12+
children?: ReactNode
1113
}
1214

1315
const PROMISE_TIMEOUT = 5
@@ -25,19 +27,17 @@ const initialProps = {
2527
}),
2628
),
2729
}
28-
// eslint-disable-next-line react/prop-types
29-
const wrapper = ({ children }: { children?: React.ReactNode }) => (
30+
const wrapper = ({ children }: { children?: ReactNode }) => (
3031
<DataLoaderProvider>{children}</DataLoaderProvider>
3132
)
3233

33-
const wrapperWithCacheKey = ({ children }: { children?: React.ReactNode }) => (
34+
const wrapperWithCacheKey = ({ children }: { children?: ReactNode }) => (
3435
<DataLoaderProvider cacheKeyPrefix="sample">{children}</DataLoaderProvider>
3536
)
3637

3738
const wrapperWithOnError =
3839
(onError: (err: Error) => void) =>
39-
// eslint-disable-next-line react/require-default-props
40-
({ children }: { children?: React.ReactNode }) =>
40+
({ children }: { children?: ReactNode }) =>
4141
<DataLoaderProvider onError={onError}>{children}</DataLoaderProvider>
4242

4343
describe('useDataLoader', () => {

packages/use-dataloader/src/__tests__/usePaginatedDataLoader.test.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { act } from '@testing-library/react'
22
import { renderHook } from '@testing-library/react-hooks'
3+
import { ReactNode } from 'react'
34
import DataLoaderProvider from '../DataLoaderProvider'
45
import { KEY_IS_NOT_STRING_ERROR } from '../constants'
56
import {
@@ -13,6 +14,7 @@ type UseDataLoaderHookProps = {
1314
config: UsePaginatedDataLoaderConfig<unknown>
1415
key: string
1516
method: (params: UsePaginatedDataLoaderMethodParams) => Promise<unknown>
17+
children?: ReactNode
1618
}
1719

1820
const PROMISE_TIMEOUT = 5
@@ -30,7 +32,7 @@ const initialProps = {
3032
),
3133
}
3234
// eslint-disable-next-line react/prop-types
33-
const wrapper = ({ children }: { children?: React.ReactNode }) => (
35+
const wrapper = ({ children }: { children?: ReactNode }) => (
3436
<DataLoaderProvider>{children}</DataLoaderProvider>
3537
)
3638

packages/use-gtm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@
2727
},
2828
"license": "MIT",
2929
"peerDependencies": {
30-
"react": "17.x"
30+
"react": "17.x || 18.x"
3131
}
3232
}

packages/use-i18n/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
},
3737
"peerDependencies": {
3838
"date-fns": "2.x",
39-
"react": "17.x",
40-
"react-dom": "17.x"
39+
"react": "17.x || 18.x",
40+
"react-dom": "17.x || 18.x"
4141
}
4242
}

packages/use-i18n/src/__tests__/usei18n.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { act, renderHook } from '@testing-library/react-hooks'
22
import mockdate from 'mockdate'
3+
import { ReactNode } from 'react'
34
import I18n, { useI18n, useTranslation } from '..'
45
import en from './locales/en.json'
56
import es from './locales/es.json'
@@ -20,7 +21,7 @@ const wrapper =
2021
localeItemStorage = LOCALE_ITEM_STORAGE,
2122
supportedLocales = ['en', 'fr', 'es'],
2223
} = {}) =>
23-
({ children }: { children: React.ReactNode }) =>
24+
({ children }: { children: ReactNode }) =>
2425
(
2526
<I18n
2627
loadDateLocale={loadDateLocale}
@@ -45,7 +46,7 @@ describe('i18n hook', () => {
4546

4647
it('useTranslation should not be defined without I18nProvider', () => {
4748
const { result } = renderHook(() => useTranslation(), {
48-
wrapper: ({ children }) => <div>{children}</div>,
49+
wrapper: ({ children }: { children: ReactNode }) => <div>{children}</div>,
4950
})
5051
expect(() => {
5152
expect(result.current).toBe(undefined)
@@ -54,7 +55,7 @@ describe('i18n hook', () => {
5455

5556
it('useI18n should not be defined without I18nProvider', () => {
5657
const { result } = renderHook(() => useI18n(), {
57-
wrapper: ({ children }) => <div>{children}</div>,
58+
wrapper: ({ children }: { children: ReactNode }) => <div>{children}</div>,
5859
})
5960
expect(() => {
6061
expect(result.current).toBe(undefined)

packages/use-i18n/src/usei18n.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ const I18nContextProvider = ({
218218
const preparedValues = prefix ? prefixKeys(`${prefix}.`)(values) : values
219219

220220
// avoid a lot of render when async update
221+
// This is handled automatically in react 18, but we leave it here for compat
222+
// https://github.com/reactwg/react-18/discussions/21#discussioncomment-801703
221223
ReactDOM.unstable_batchedUpdates(() => {
222224
setTranslations(prevState => ({
223225
...prevState,

packages/use-query-params/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@
3232
"query-string": "7.1.1"
3333
},
3434
"peerDependencies": {
35-
"react": "17.x",
36-
"react-dom": "17.x",
35+
"react": "17.x || 18.x",
36+
"react-dom": "17.x || 18.x",
3737
"react-router-dom": "^6.0.0"
3838
},
3939
"devDependencies": {
40-
"react": "17.0.2",
41-
"react-dom": "17.0.2",
40+
"react": "18.1.0",
41+
"react-dom": "18.1.0",
4242
"react-router-dom": "6.3.0"
4343
}
4444
}

0 commit comments

Comments
 (0)