Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Remove useEffect from TimeElapsed (#3741)

authored by

dan and committed by
GitHub
361d255e 256bb33d

+4 -4
+4 -4
src/view/com/util/TimeElapsed.tsx
··· 3 3 import {useTickEveryMinute} from '#/state/shell' 4 4 import {ago} from 'lib/strings/time' 5 5 6 - // FIXME(dan): Figure out why the false positives 7 - 8 6 export function TimeElapsed({ 9 7 timestamp, 10 8 children, ··· 15 13 const tick = useTickEveryMinute() 16 14 const [timeElapsed, setTimeAgo] = React.useState(() => ago(timestamp)) 17 15 18 - React.useEffect(() => { 16 + const [prevTick, setPrevTick] = React.useState(tick) 17 + if (prevTick !== tick) { 18 + setPrevTick(tick) 19 19 setTimeAgo(ago(timestamp)) 20 - }, [timestamp, setTimeAgo, tick]) 20 + } 21 21 22 22 return children({timeElapsed}) 23 23 }