Fix effect cleanup
This commit is contained in:
@@ -479,19 +479,19 @@ let VideoItem = ({
|
|||||||
const {sendInteraction} = useFeedFeedbackContext()
|
const {sendInteraction} = useFeedFeedbackContext()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let to: NodeJS.Timeout | null = null
|
if (active) {
|
||||||
if (active && !to) {
|
const to = setTimeout(() => {
|
||||||
to = setTimeout(() => {
|
|
||||||
sendInteraction({
|
sendInteraction({
|
||||||
item: post.uri,
|
item: post.uri,
|
||||||
event: 'app.bsky.feed.defs#interactionSeen',
|
event: 'app.bsky.feed.defs#interactionSeen',
|
||||||
feedContext,
|
feedContext,
|
||||||
})
|
})
|
||||||
}, 1000)
|
}, 1000)
|
||||||
} else if (!active && to) {
|
return () => {
|
||||||
clearTimeout(to)
|
clearTimeout(to)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [active, post, feedContext, sendInteraction])
|
}, [active, post.uri, feedContext, sendInteraction])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[a.relative, {height, width}]}>
|
<View style={[a.relative, {height, width}]}>
|
||||||
|
|||||||
Reference in New Issue
Block a user