Skip to content

Commit 751c957

Browse files
authored
Merge branch 'canary' into remove-react-modes-config
2 parents a38b832 + cce82cd commit 751c957

File tree

5 files changed

+40
-20
lines changed

5 files changed

+40
-20
lines changed

test/integration/router-is-ready/pages/auto-export/[slug].js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import { useRouter } from 'next/router'
2+
import { useLayoutEffect } from 'react'
23

34
export default function Page(props) {
45
const router = useRouter()
56

67
if (typeof window !== 'undefined') {
7-
if (!window.isReadyValues) {
8-
window.isReadyValues = []
9-
}
10-
window.isReadyValues.push(router.isReady)
8+
// eslint-disable-next-line react-hooks/rules-of-hooks
9+
useLayoutEffect(() => {
10+
if (!window.isReadyValues) {
11+
window.isReadyValues = []
12+
}
13+
window.isReadyValues.push(router.isReady)
14+
}, [router])
1115
}
1216

1317
return (

test/integration/router-is-ready/pages/auto-export/index.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import { useRouter } from 'next/router'
2+
import { useLayoutEffect } from 'react'
23

34
export default function Page(props) {
45
const router = useRouter()
56

67
if (typeof window !== 'undefined') {
7-
if (!window.isReadyValues) {
8-
window.isReadyValues = []
9-
}
10-
window.isReadyValues.push(router.isReady)
8+
// eslint-disable-next-line react-hooks/rules-of-hooks
9+
useLayoutEffect(() => {
10+
if (!window.isReadyValues) {
11+
window.isReadyValues = []
12+
}
13+
window.isReadyValues.push(router.isReady)
14+
}, [router])
1115
}
1216

1317
return (

test/integration/router-is-ready/pages/gip.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import { useRouter } from 'next/router'
2+
import { useLayoutEffect } from 'react'
23

34
export default function Page(props) {
45
const router = useRouter()
56

67
if (typeof window !== 'undefined') {
7-
if (!window.isReadyValues) {
8-
window.isReadyValues = []
9-
}
10-
window.isReadyValues.push(router.isReady)
8+
// eslint-disable-next-line react-hooks/rules-of-hooks
9+
useLayoutEffect(() => {
10+
if (!window.isReadyValues) {
11+
window.isReadyValues = []
12+
}
13+
window.isReadyValues.push(router.isReady)
14+
}, [router])
1115
}
1216

1317
return (

test/integration/router-is-ready/pages/gsp.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import { useRouter } from 'next/router'
2+
import { useLayoutEffect } from 'react'
23

34
export default function Page(props) {
45
const router = useRouter()
56

67
if (typeof window !== 'undefined') {
7-
if (!window.isReadyValues) {
8-
window.isReadyValues = []
9-
}
10-
window.isReadyValues.push(router.isReady)
8+
// eslint-disable-next-line react-hooks/rules-of-hooks
9+
useLayoutEffect(() => {
10+
if (!window.isReadyValues) {
11+
window.isReadyValues = []
12+
}
13+
window.isReadyValues.push(router.isReady)
14+
}, [router])
1115
}
1216

1317
return (

test/integration/router-is-ready/pages/gssp.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import { useRouter } from 'next/router'
2+
import { useLayoutEffect } from 'react'
23

34
export default function Page(props) {
45
const router = useRouter()
56

67
if (typeof window !== 'undefined') {
7-
if (!window.isReadyValues) {
8-
window.isReadyValues = []
9-
}
10-
window.isReadyValues.push(router.isReady)
8+
// eslint-disable-next-line react-hooks/rules-of-hooks
9+
useLayoutEffect(() => {
10+
if (!window.isReadyValues) {
11+
window.isReadyValues = []
12+
}
13+
window.isReadyValues.push(router.isReady)
14+
}, [router])
1115
}
1216

1317
return (

0 commit comments

Comments
 (0)