File tree Expand file tree Collapse file tree 3 files changed +6
-8
lines changed Expand file tree Collapse file tree 3 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -257,7 +257,7 @@ export const Animated = () => {
257
257
} ) ;
258
258
} , 3000 ) ;
259
259
return ( ) => {
260
- clearTimeout ( timerRef . current ) ;
260
+ window . clearTimeout ( timerRef . current ) ;
261
261
} ;
262
262
}
263
263
} , [ count , hasDynamicContent ] ) ;
Original file line number Diff line number Diff line change @@ -174,7 +174,7 @@ export const AsyncUpdate = () => {
174
174
175
175
React . useEffect ( ( ) => {
176
176
return ( ) => {
177
- clearTimeout ( timerRef . current ) ;
177
+ window . clearTimeout ( timerRef . current ) ;
178
178
} ;
179
179
} , [ ] ) ;
180
180
Original file line number Diff line number Diff line change 1
1
import * as React from 'react' ;
2
- import { Presence , DocumentContext } from 'radix-ui/internal' ;
2
+ import { Presence } from 'radix-ui/internal' ;
3
3
import styles from './presence.stories.module.css' ;
4
4
5
5
export default { title : 'Utilities/Presence' } ;
@@ -35,17 +35,15 @@ export const WithDeferredMountAnimation = () => {
35
35
const timerRef = React . useRef ( 0 ) ;
36
36
const [ open , setOpen ] = React . useState ( false ) ;
37
37
const [ animate , setAnimate ] = React . useState ( false ) ;
38
- const documentWindow = DocumentContext . useDocument ( ) ?. defaultView ;
39
38
40
39
React . useEffect ( ( ) => {
41
- if ( ! documentWindow ) return ;
42
40
if ( open ) {
43
- timerRef . current = documentWindow . setTimeout ( ( ) => setAnimate ( true ) , 150 ) ;
41
+ timerRef . current = window . setTimeout ( ( ) => setAnimate ( true ) , 150 ) ;
44
42
} else {
45
43
setAnimate ( false ) ;
46
- documentWindow . clearTimeout ( timerRef . current ) ;
44
+ window . clearTimeout ( timerRef . current ) ;
47
45
}
48
- } , [ open , documentWindow ] ) ;
46
+ } , [ open ] ) ;
49
47
50
48
return (
51
49
< >
You can’t perform that action at this time.
0 commit comments