1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00
This commit is contained in:
xmflsct
2023-02-24 13:54:27 +01:00
parent b1a796d3f1
commit 04a56edcf4
5 changed files with 22 additions and 24 deletions

View File

@ -167,12 +167,12 @@ const Timeline: React.FC<Props> = ({
}
)
const latestMarker = useRef<string>()
const latestMarker = useRef<string>('')
const updateMarkers = useCallback(
throttle(() => {
if (readMarker) {
const currentMarker = getAccountStorage.string(readMarker) || '0'
if ((latestMarker.current || '0') > currentMarker) {
if (latestMarker.current > currentMarker) {
setAccountStorage([{ key: readMarker, value: latestMarker.current }])
} else {
// setAccountStorage([{ key: readMarker, value: '105250709762254246' }])
@ -183,9 +183,12 @@ const Timeline: React.FC<Props> = ({
)
readMarker &&
useEffect(() => {
const unsubscribe = navigation.addListener('blur', () =>
setAccountStorage([{ key: readMarker, value: latestMarker.current }])
)
const unsubscribe = navigation.addListener('blur', () => {
const currentMarker = getAccountStorage.string(readMarker) || '0'
if (latestMarker.current > currentMarker) {
setAccountStorage([{ key: readMarker, value: latestMarker.current }])
}
})
return unsubscribe
}, [])
const viewabilityConfigCallbackPairs = useRef<