Skip to content

Commit 7014561

Browse files
committed
Only set hasBeenInView once
1 parent f176cdd commit 7014561

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

dotcom-rendering/src/components/LoopVideo.importable.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,10 @@ export const LoopVideo = ({
139139
}, [uniqueId]);
140140

141141
useEffect(() => {
142-
if (isInView) {
142+
if (isInView && !hasBeenInView) {
143143
setHasBeenInView(true);
144144
}
145-
}, [isInView]);
145+
}, [isInView, hasBeenInView]);
146146

147147
/**
148148
* Autoplay the video when it comes into view.

0 commit comments

Comments
 (0)