Skip to content

Commit

Permalink
Use document insetad of window.document.
Browse files Browse the repository at this point in the history
  • Loading branch information
amovar18 committed Dec 27, 2024
1 parent 887f548 commit 3b4d7f9
Showing 1 changed file with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,40 +99,36 @@ const Provider = ({ children }: PropsWithChildren) => {
}, [pageNumber]);

useEffect(() => {
window.document.addEventListener(
document.addEventListener(
'webStoriesLightBoxEvent',
//@ts-ignore since this is a custom event.
(event) => setStoryOpened(event.detail.storyOpened),
false
);

window.document.addEventListener(
document.addEventListener(
'iframeLoaded',
() => setIframeLoaded(true),
false
);

window.document.addEventListener(
'loadMoreData',
webStoriesLoadMoreData,
false
);
document.addEventListener('loadMoreData', webStoriesLoadMoreData, false);

return () => {
window.document.removeEventListener(
document.removeEventListener(
'iframeLoaded',
() => setIframeLoaded(true),
false
);

window.document.removeEventListener(
document.removeEventListener(
'webStoriesLightBoxEvent',
//@ts-ignore since this is a custom event.
(event) => setStoryOpened(event.detail.storyOpened),
false
);

window.document.removeEventListener(
document.removeEventListener(
'loadMoreData',
webStoriesLoadMoreData,
false
Expand Down

0 comments on commit 3b4d7f9

Please sign in to comment.