fix immutability errors

This commit is contained in:
Samuel Newman
2025-10-08 17:09:03 +03:00
parent 461f56a342
commit aac898d229
7 changed files with 36 additions and 29 deletions
@@ -16,13 +16,13 @@ export function VideoEmbedInnerWeb({
active,
setActive,
onScreen,
lastKnownTime,
lastKnownTime: lastKnownTimeRef,
}: {
embed: AppBskyEmbedVideo.View
active: boolean
setActive: () => void
onScreen: boolean
lastKnownTime: React.MutableRefObject<number | undefined>
lastKnownTime: React.RefObject<number | undefined>
}) {
const containerRef = useRef<HTMLDivElement>(null)
const videoRef = useRef<HTMLVideoElement>(null)
@@ -47,10 +47,10 @@ export function VideoEmbedInnerWeb({
})
useEffect(() => {
if (lastKnownTime.current && videoRef.current) {
videoRef.current.currentTime = lastKnownTime.current
if (lastKnownTimeRef.current && videoRef.current) {
videoRef.current.currentTime = lastKnownTimeRef.current
}
}, [lastKnownTime])
}, [lastKnownTimeRef])
return (
<View
@@ -68,7 +68,7 @@ export function VideoEmbedInnerWeb({
muted={!focused}
aria-labelledby={embed.alt ? figId : undefined}
onTimeUpdate={e => {
lastKnownTime.current = e.currentTarget.currentTime
lastKnownTimeRef.current = e.currentTarget.currentTime
}}
/>
{embed.alt && (