File tree 2 files changed +10
-12
lines changed
2 files changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -151,14 +151,6 @@ class Container extends React.Component<{
151
151
}
152
152
)
153
153
}
154
-
155
- if ( process . env . __NEXT_TEST_MODE ) {
156
- window . __NEXT_HYDRATED = true
157
-
158
- if ( window . __NEXT_HYDRATED_CB ) {
159
- window . __NEXT_HYDRATED_CB ( )
160
- }
161
- }
162
154
}
163
155
164
156
componentDidUpdate ( ) {
@@ -719,5 +711,15 @@ function Root({
719
711
// We use `useLayoutEffect` to guarantee the callback is executed
720
712
// as soon as React flushes the update.
721
713
React . useLayoutEffect ( ( ) => callback ( ) , [ callback ] )
714
+ if ( process . env . __NEXT_TEST_MODE ) {
715
+ // eslint-disable-next-line react-hooks/rules-of-hooks
716
+ React . useEffect ( ( ) => {
717
+ window . __NEXT_HYDRATED = true
718
+
719
+ if ( window . __NEXT_HYDRATED_CB ) {
720
+ window . __NEXT_HYDRATED_CB ( )
721
+ }
722
+ } , [ ] )
723
+ }
722
724
return children as React . ReactElement
723
725
}
Original file line number Diff line number Diff line change @@ -37,10 +37,6 @@ export async function sandbox(
37
37
env : { __NEXT_TEST_WITH_DEVTOOL : 1 } ,
38
38
} )
39
39
const browser = await webdriver ( appPort , '/' )
40
-
41
- // Slow down tests a bit to ensure application is ready:
42
- await new Promise ( ( resolve ) => setTimeout ( resolve , 750 ) )
43
-
44
40
return [
45
41
{
46
42
sandboxDirectory,
You can’t perform that action at this time.
0 commit comments