mirror of
https://github.com/tooot-app/app
synced 2025-04-16 11:17:29 +02:00
Update sentry reporting
This commit is contained in:
parent
e3c84f6146
commit
e92a7907e6
@ -58,9 +58,9 @@ const apiGeneral = async <T = unknown>({
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
if (sentry && Math.random() < 0.001) {
|
if (sentry && Math.random() < 0.01) {
|
||||||
Sentry.Native.setExtras({
|
Sentry.Native.setExtras({
|
||||||
API: 'instance',
|
API: 'general',
|
||||||
...(error.response && { response: error.response }),
|
...(error.response && { response: error.response }),
|
||||||
...(error.request && { request: error.request })
|
...(error.request && { request: error.request })
|
||||||
})
|
})
|
||||||
|
@ -61,7 +61,7 @@ const apiTooot = async <T = unknown>({
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
if (sentry && Math.random() < 0.005) {
|
if (sentry && Math.random() < 0.01) {
|
||||||
Sentry.Native.setExtras({
|
Sentry.Native.setExtras({
|
||||||
API: 'tooot',
|
API: 'tooot',
|
||||||
...(error.response && { response: error.response }),
|
...(error.response && { response: error.response }),
|
||||||
|
@ -7,6 +7,7 @@ import { findIndex } from 'lodash'
|
|||||||
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
import React, { useCallback, useEffect, useRef, useState } from 'react'
|
||||||
import { FlatList } from 'react-native'
|
import { FlatList } from 'react-native'
|
||||||
import { InfiniteQueryObserver, useQueryClient } from 'react-query'
|
import { InfiniteQueryObserver, useQueryClient } from 'react-query'
|
||||||
|
import * as Sentry from 'sentry-expo'
|
||||||
|
|
||||||
const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
||||||
route: {
|
route: {
|
||||||
@ -40,6 +41,7 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
|||||||
if (!scrolled.current) {
|
if (!scrolled.current) {
|
||||||
scrolled.current = true
|
scrolled.current = true
|
||||||
const pointer = findIndex(flattenData, ['id', toot.id])
|
const pointer = findIndex(flattenData, ['id', toot.id])
|
||||||
|
try {
|
||||||
pointer < flattenData.length &&
|
pointer < flattenData.length &&
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
flRef.current?.scrollToIndex({
|
flRef.current?.scrollToIndex({
|
||||||
@ -47,23 +49,48 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
|||||||
viewOffset: 100
|
viewOffset: 100
|
||||||
})
|
})
|
||||||
}, 500)
|
}, 500)
|
||||||
|
} catch (err) {
|
||||||
|
if (Math.random() < 0.1) {
|
||||||
|
Sentry.Native.setExtras({
|
||||||
|
type: 'original',
|
||||||
|
index: pointer,
|
||||||
|
itemsLength: flattenData.length,
|
||||||
|
flattenData
|
||||||
|
})
|
||||||
|
Sentry.Native.captureException(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return () => unsubscribe()
|
return () => unsubscribe()
|
||||||
}, [])
|
}, [scrolled.current])
|
||||||
|
|
||||||
// Toot page auto scroll to selected toot
|
// Toot page auto scroll to selected toot
|
||||||
const onScrollToIndexFailed = useCallback(
|
const onScrollToIndexFailed = useCallback(
|
||||||
error => {
|
error => {
|
||||||
const offset = error.averageItemLength * error.index
|
const offset = error.averageItemLength * error.index
|
||||||
flRef.current?.scrollToOffset({ offset })
|
flRef.current?.scrollToOffset({ offset })
|
||||||
|
try {
|
||||||
|
error.index < itemsLength &&
|
||||||
setTimeout(
|
setTimeout(
|
||||||
() =>
|
() =>
|
||||||
error.index < itemsLength &&
|
flRef.current?.scrollToIndex({
|
||||||
flRef.current?.scrollToIndex({ index: error.index, viewOffset: 100 }),
|
index: error.index,
|
||||||
|
viewOffset: 100
|
||||||
|
}),
|
||||||
500
|
500
|
||||||
)
|
)
|
||||||
|
} catch (err) {
|
||||||
|
if (Math.random() < 0.1) {
|
||||||
|
Sentry.Native.setExtras({
|
||||||
|
type: 'onScrollToIndexFailed',
|
||||||
|
index: error.index,
|
||||||
|
itemsLength
|
||||||
|
})
|
||||||
|
Sentry.Native.captureException(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
[itemsLength]
|
[itemsLength]
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user