Skip to content

Commit ec27334

Browse files
committed
minor storybook tweaks
1 parent 7f3aa1f commit ec27334

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

apps/storybook/stories/accordion.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ export const Animated = () => {
257257
});
258258
}, 3000);
259259
return () => {
260-
clearTimeout(timerRef.current);
260+
window.clearTimeout(timerRef.current);
261261
};
262262
}
263263
}, [count, hasDynamicContent]);

apps/storybook/stories/hover-card.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ export const AsyncUpdate = () => {
174174

175175
React.useEffect(() => {
176176
return () => {
177-
clearTimeout(timerRef.current);
177+
window.clearTimeout(timerRef.current);
178178
};
179179
}, []);
180180

apps/storybook/stories/presence.stories.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { Presence, DocumentContext } from 'radix-ui/internal';
2+
import { Presence } from 'radix-ui/internal';
33
import styles from './presence.stories.module.css';
44

55
export default { title: 'Utilities/Presence' };
@@ -35,17 +35,15 @@ export const WithDeferredMountAnimation = () => {
3535
const timerRef = React.useRef(0);
3636
const [open, setOpen] = React.useState(false);
3737
const [animate, setAnimate] = React.useState(false);
38-
const documentWindow = DocumentContext.useDocument()?.defaultView;
3938

4039
React.useEffect(() => {
41-
if (!documentWindow) return;
4240
if (open) {
43-
timerRef.current = documentWindow.setTimeout(() => setAnimate(true), 150);
41+
timerRef.current = window.setTimeout(() => setAnimate(true), 150);
4442
} else {
4543
setAnimate(false);
46-
documentWindow.clearTimeout(timerRef.current);
44+
window.clearTimeout(timerRef.current);
4745
}
48-
}, [open, documentWindow]);
46+
}, [open]);
4947

5048
return (
5149
<>

0 commit comments

Comments
 (0)