mirror of
https://github.com/tooot-app/app
synced 2025-02-11 17:30:50 +01:00
Try to fix toot id not found
This commit is contained in:
parent
ee71733676
commit
9936f6c921
@ -4,7 +4,7 @@
|
|||||||
"native": "220206",
|
"native": "220206",
|
||||||
"major": 3,
|
"major": 3,
|
||||||
"minor": 4,
|
"minor": 4,
|
||||||
"patch": 2,
|
"patch": 3,
|
||||||
"expo": "44.0.0"
|
"expo": "44.0.0"
|
||||||
},
|
},
|
||||||
"description": "tooot app for Mastodon",
|
"description": "tooot app for Mastodon",
|
||||||
|
@ -35,29 +35,30 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
|||||||
? // @ts-ignore
|
? // @ts-ignore
|
||||||
result.data.pages.flatMap(d => [...d.body])
|
result.data.pages.flatMap(d => [...d.body])
|
||||||
: []
|
: []
|
||||||
setItemsLength(flattenData.length)
|
|
||||||
// Auto go back when toot page is empty
|
// Auto go back when toot page is empty
|
||||||
if (flattenData.length === 0) {
|
if (flattenData.length === 0) {
|
||||||
navigation.goBack()
|
navigation.goBack()
|
||||||
}
|
}
|
||||||
|
setItemsLength(flattenData.length)
|
||||||
if (!scrolled.current) {
|
if (!scrolled.current) {
|
||||||
scrolled.current = true
|
scrolled.current = true
|
||||||
const pointer = flattenData.findIndex(({ id }) => id === toot.id)
|
const pointer = flattenData.findIndex(({ id }) => id === toot.id)
|
||||||
|
if (pointer === -1) return
|
||||||
try {
|
try {
|
||||||
pointer < flattenData.length &&
|
setTimeout(() => {
|
||||||
setTimeout(() => {
|
flRef.current?.scrollToIndex({
|
||||||
flRef.current?.scrollToIndex({
|
index: pointer,
|
||||||
index: pointer,
|
viewOffset: 100
|
||||||
viewOffset: 100
|
})
|
||||||
})
|
}, 500)
|
||||||
}, 500)
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (Math.random() < 0.1) {
|
if (Math.random() < 0.1) {
|
||||||
Sentry.Native.setContext('Scroll to Index', {
|
Sentry.Native.setContext('Scroll to Index', {
|
||||||
type: 'original',
|
type: 'original',
|
||||||
index: pointer,
|
index: pointer,
|
||||||
itemsLength: flattenData.length,
|
itemsLength: flattenData.length,
|
||||||
flattenData
|
id: toot.id,
|
||||||
|
flattenData: flattenData.map(({ id }) => id)
|
||||||
})
|
})
|
||||||
Sentry.Native.captureException(err)
|
Sentry.Native.captureException(err)
|
||||||
}
|
}
|
||||||
@ -87,7 +88,8 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
|||||||
Sentry.Native.setContext('Scroll to Index', {
|
Sentry.Native.setContext('Scroll to Index', {
|
||||||
type: 'onScrollToIndexFailed',
|
type: 'onScrollToIndexFailed',
|
||||||
index: error.index,
|
index: error.index,
|
||||||
itemsLength
|
itemsLength,
|
||||||
|
id: toot.id
|
||||||
})
|
})
|
||||||
Sentry.Native.captureException(err)
|
Sentry.Native.captureException(err)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user