Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
1c45f709
Unverified
Commit
1c45f709
authored
Sep 01, 2020
by
Joe Haddad
Committed by
GitHub
Sep 01, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[test] Update hydration marker for React 17 (#16756)
parent
d20dbd6c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
12 deletions
+10
-12
index.tsx
packages/next/client/index.tsx
+10
-8
helpers.js
test/acceptance/helpers.js
+0
-4
No files found.
packages/next/client/index.tsx
View file @
1c45f709
...
@@ -151,14 +151,6 @@ class Container extends React.Component<{
...
@@ -151,14 +151,6 @@ class Container extends React.Component<{
}
}
)
)
}
}
if
(
process
.
env
.
__NEXT_TEST_MODE
)
{
window
.
__NEXT_HYDRATED
=
true
if
(
window
.
__NEXT_HYDRATED_CB
)
{
window
.
__NEXT_HYDRATED_CB
()
}
}
}
}
componentDidUpdate
()
{
componentDidUpdate
()
{
...
@@ -719,5 +711,15 @@ function Root({
...
@@ -719,5 +711,15 @@ function Root({
// We use `useLayoutEffect` to guarantee the callback is executed
// We use `useLayoutEffect` to guarantee the callback is executed
// as soon as React flushes the update.
// as soon as React flushes the update.
React
.
useLayoutEffect
(()
=>
callback
(),
[
callback
])
React
.
useLayoutEffect
(()
=>
callback
(),
[
callback
])
if
(
process
.
env
.
__NEXT_TEST_MODE
)
{
// eslint-disable-next-line react-hooks/rules-of-hooks
React
.
useEffect
(()
=>
{
window
.
__NEXT_HYDRATED
=
true
if
(
window
.
__NEXT_HYDRATED_CB
)
{
window
.
__NEXT_HYDRATED_CB
()
}
},
[])
}
return
children
as
React
.
ReactElement
return
children
as
React
.
ReactElement
}
}
test/acceptance/helpers.js
View file @
1c45f709
...
@@ -37,10 +37,6 @@ export async function sandbox(
...
@@ -37,10 +37,6 @@ export async function sandbox(
env
:
{
__NEXT_TEST_WITH_DEVTOOL
:
1
},
env
:
{
__NEXT_TEST_WITH_DEVTOOL
:
1
},
})
})
const
browser
=
await
webdriver
(
appPort
,
'/'
)
const
browser
=
await
webdriver
(
appPort
,
'/'
)
// Slow down tests a bit to ensure application is ready:
await
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
750
))
return
[
return
[
{
{
sandboxDirectory
,
sandboxDirectory
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment