diff --git a/src/components/GracefullyImage.tsx b/src/components/GracefullyImage.tsx index c357576d..73e55820 100644 --- a/src/components/GracefullyImage.tsx +++ b/src/components/GracefullyImage.tsx @@ -55,14 +55,9 @@ const GracefullyImage = ({ const { colors } = useTheme() const [imageLoaded, setImageLoaded] = useState(false) + const [currentUri, setCurrentUri] = useState(uri.original || uri.remote) const source = { - uri: reduceMotionEnabled && uri.static ? uri.static : uri.original - } - const onLoad = () => { - setImageLoaded(true) - if (setImageDimensions && source.uri) { - Image.getSize(source.uri, (width, height) => setImageDimensions({ width, height })) - } + uri: reduceMotionEnabled && uri.static ? uri.static : currentUri } const blurhashView = () => { @@ -92,11 +87,19 @@ const GracefullyImage = ({ /> ) : null} { + setImageLoaded(true) + if (setImageDimensions && source.uri) { + Image.getSize(source.uri, (width, height) => setImageDimensions({ width, height })) + } + }} + onError={() => { + if (uri.original && uri.original === currentUri && uri.remote) { + setCurrentUri(uri.remote) + } + }} /> {blurhashView()} diff --git a/src/components/Timeline/Notifications.tsx b/src/components/Timeline/Notifications.tsx index 108f8eac..8f2ad75f 100644 --- a/src/components/Timeline/Notifications.tsx +++ b/src/components/Timeline/Notifications.tsx @@ -126,7 +126,7 @@ const TimelineNotifications: React.FC = ({ notification, queryKey }) => { } if (filterResults?.length && !filterRevealed) { - return !filterResults.filter(result => result.filter_action === 'hide').length ? ( + return !filterResults.filter(result => result.filter_action === 'hide')?.length ? ( setFilterRevealed(!filterRevealed)}> diff --git a/src/components/Timeline/Refresh.tsx b/src/components/Timeline/Refresh.tsx index c08a7a36..adda245c 100644 --- a/src/components/Timeline/Refresh.tsx +++ b/src/components/Timeline/Refresh.tsx @@ -144,7 +144,7 @@ const TimelineRefresh: React.FC = ({ >(queryKey)?.pages[0] prevActive.current = true - prevStatusId.current = firstPage?.body[0].id + prevStatusId.current = firstPage?.body[0]?.id await queryFunctionTimeline({ queryKey, @@ -182,7 +182,7 @@ const TimelineRefresh: React.FC = ({ flRef.current?.scrollToOffset({ offset: scrollY.value - 15, animated: true }) } - await new Promise(promise => setTimeout(promise, 32)) + await new Promise(promise => setTimeout(promise, 64)) queryClient.setQueryData< InfiniteData< PagedResponse<(Mastodon.Status | Mastodon.Notification | Mastodon.Conversation)[]> diff --git a/src/screens/Tabs/Me/Profile/Root.tsx b/src/screens/Tabs/Me/Profile/Root.tsx index 27d4331f..0bb095f2 100644 --- a/src/screens/Tabs/Me/Profile/Root.tsx +++ b/src/screens/Tabs/Me/Profile/Root.tsx @@ -49,7 +49,7 @@ const TabMeProfileRoot: React.FC< { diff --git a/src/screens/Tabs/Shared/Account/Information/Account.tsx b/src/screens/Tabs/Shared/Account/Information/Account.tsx index 3c8f3ac2..38bb05a6 100644 --- a/src/screens/Tabs/Shared/Account/Information/Account.tsx +++ b/src/screens/Tabs/Shared/Account/Information/Account.tsx @@ -18,7 +18,7 @@ const AccountInformationAccount: React.FC = () => { const [acct] = useAccountStorage.string('auth.account.acct') const domain = getAccountStorage.string('auth.account.domain') - const localInstance = account?.acct.includes('@') ? account?.acct.includes(`@${domain}`) : true + const localInstance = account?.acct?.includes('@') ? account?.acct?.includes(`@${domain}`) : true if (account || pageMe) { return ( diff --git a/src/screens/Tabs/Shared/Toot.tsx b/src/screens/Tabs/Shared/Toot.tsx index 576bb249..fc83d9f1 100644 --- a/src/screens/Tabs/Shared/Toot.tsx +++ b/src/screens/Tabs/Shared/Toot.tsx @@ -182,7 +182,7 @@ const TabSharedToot: React.FC> = ({ }, { enabled: - query.isFetched && + (toot._remote ? true : query.isFetched) && ['public', 'unlisted'].includes(toot.visibility) && match?.domain !== getAccountStorage.string('auth.domain'), staleTime: 0, @@ -193,12 +193,12 @@ const TabSharedToot: React.FC> = ({ return } - if ((query.data?.pages[0].body.length || 0) < data.length) { + if ((query.data?.pages[0].body.length || 0) - 1 <= data.length) { queryClient.cancelQueries(queryKey.local) queryClient.setQueryData<{ pages: { body: Mastodon.Status[] }[] }>(queryKey.local, old => { - if (!old) return old + if (!old) return { pages: [{ body: [toot] }] } setHasRemoteContent(true) return { @@ -355,7 +355,7 @@ const TabSharedToot: React.FC> = ({ `h ${ARC}` } strokeWidth={1} - stroke={colors.red} + stroke={colors.border} strokeOpacity={0.6} /> @@ -375,7 +375,7 @@ const TabSharedToot: React.FC> = ({ } }) : null} - @@ -386,7 +386,7 @@ const TabSharedToot: React.FC> = ({ + /> */} ) }}