Address feedback and lint warnings

This commit is contained in:
DS Boyce
2026-02-11 09:46:47 -08:00
parent 4356ff0040
commit 355868e01e
+27 -27
View File
@@ -1,4 +1,4 @@
import React, {useCallback, useMemo} from 'react' import {useCallback, useEffect, useMemo, useRef, useState} from 'react'
import {StyleSheet} from 'react-native' import {StyleSheet} from 'react-native'
import {SafeAreaView} from 'react-native-safe-area-context' import {SafeAreaView} from 'react-native-safe-area-context'
import { import {
@@ -79,45 +79,45 @@ function ProfileScreenInner({route}: Props) {
data: resolvedDid, data: resolvedDid,
error: resolveError, error: resolveError,
refetch: refetchDid, refetch: refetchDid,
status: didStatus, isPending: isDidPending,
} = useResolveDidQuery(name) } = useResolveDidQuery(name)
const { const {
data: profile, data: profile,
error: profileError, error: profileError,
refetch: refetchProfile, refetch: refetchProfile,
isPlaceholderData: isPlaceholderProfile, isPlaceholderData: isPlaceholderProfile,
status: profileStatus, isPending: isProfilePending,
} = useProfileQuery({ } = useProfileQuery({
did: resolvedDid, did: resolvedDid,
}) })
const onPressTryAgain = React.useCallback(() => { const onPressTryAgain = useCallback(() => {
if (resolveError) { if (resolveError) {
refetchDid() void refetchDid()
} else { } else {
refetchProfile() void refetchProfile()
} }
}, [resolveError, refetchDid, refetchProfile]) }, [resolveError, refetchDid, refetchProfile])
// Apply hard-coded redirects as need // Apply hard-coded redirects as need
React.useEffect(() => { useEffect(() => {
if (resolveError) { if (resolveError) {
if (name === 'lulaoficial.bsky.social') { if (name === 'lulaoficial.bsky.social') {
console.log('Applying redirect to lula.com.br') console.log('Applying redirect to lula.com.br')
navigate('Profile', {name: 'lula.com.br'}) void navigate('Profile', {name: 'lula.com.br'})
} }
} }
}, [name, resolveError]) }, [name, resolveError])
// When we open the profile, we want to reset the posts query if we are blocked. // When we open the profile, we want to reset the posts query if we are blocked.
React.useEffect(() => { useEffect(() => {
if (resolvedDid && profile?.viewer?.blockedBy) { if (resolvedDid && profile?.viewer?.blockedBy) {
resetProfilePostsQueries(queryClient, resolvedDid) resetProfilePostsQueries(queryClient, resolvedDid)
} }
}, [queryClient, profile?.viewer?.blockedBy, resolvedDid]) }, [queryClient, profile?.viewer?.blockedBy, resolvedDid])
// Most pushes will happen here, since we will have only placeholder data // Most pushes will happen here, since we will have only placeholder data
if (didStatus === 'pending' || profileStatus === 'pending') { if (isDidPending || isProfilePending) {
return ( return (
<Layout.Content> <Layout.Content>
<ProfileHeaderLoading /> <ProfileHeaderLoading />
@@ -186,20 +186,20 @@ function ProfileScreenLoaded({
did: profile.did, did: profile.did,
enabled: !!profile.associated?.labeler, enabled: !!profile.associated?.labeler,
}) })
const [currentPage, setCurrentPage] = React.useState(0) const [currentPage, setCurrentPage] = useState(0)
const {_} = useLingui() const {_} = useLingui()
const [scrollViewTag, setScrollViewTag] = React.useState<number | null>(null) const [scrollViewTag, setScrollViewTag] = useState<number | null>(null)
const postsSectionRef = React.useRef<SectionRef>(null) const postsSectionRef = useRef<SectionRef>(null)
const repliesSectionRef = React.useRef<SectionRef>(null) const repliesSectionRef = useRef<SectionRef>(null)
const mediaSectionRef = React.useRef<SectionRef>(null) const mediaSectionRef = useRef<SectionRef>(null)
const videosSectionRef = React.useRef<SectionRef>(null) const videosSectionRef = useRef<SectionRef>(null)
const likesSectionRef = React.useRef<SectionRef>(null) const likesSectionRef = useRef<SectionRef>(null)
const feedsSectionRef = React.useRef<SectionRef>(null) const feedsSectionRef = useRef<SectionRef>(null)
const listsSectionRef = React.useRef<SectionRef>(null) const listsSectionRef = useRef<SectionRef>(null)
const starterPacksSectionRef = React.useRef<SectionRef>(null) const starterPacksSectionRef = useRef<SectionRef>(null)
const labelsSectionRef = React.useRef<SectionRef>(null) const labelsSectionRef = useRef<SectionRef>(null)
useSetTitle(combinedDisplayName(profile)) useSetTitle(combinedDisplayName(profile))
@@ -315,7 +315,7 @@ function ProfileScreenLoaded({
) )
useFocusEffect( useFocusEffect(
React.useCallback(() => { useCallback(() => {
setMinimalShellMode(false) setMinimalShellMode(false)
return listenSoftReset(() => { return listenSoftReset(() => {
scrollSectionToTop(currentPage) scrollSectionToTop(currentPage)
@@ -601,16 +601,16 @@ function ProfileScreenLoaded({
function useRichText(text: string): [RichTextAPI, boolean] { function useRichText(text: string): [RichTextAPI, boolean] {
const agent = useAgent() const agent = useAgent()
const [prevText, setPrevText] = React.useState(text) const [prevText, setPrevText] = useState(text)
const [rawRT, setRawRT] = React.useState(() => new RichTextAPI({text})) const [rawRT, setRawRT] = useState(() => new RichTextAPI({text}))
const [resolvedRT, setResolvedRT] = React.useState<RichTextAPI | null>(null) const [resolvedRT, setResolvedRT] = useState<RichTextAPI | null>(null)
if (text !== prevText) { if (text !== prevText) {
setPrevText(text) setPrevText(text)
setRawRT(new RichTextAPI({text})) setRawRT(new RichTextAPI({text}))
setResolvedRT(null) setResolvedRT(null)
// This will queue an immediate re-render // This will queue an immediate re-render
} }
React.useEffect(() => { useEffect(() => {
let ignore = false let ignore = false
async function resolveRTFacets() { async function resolveRTFacets() {
// new each time // new each time
@@ -620,7 +620,7 @@ function useRichText(text: string): [RichTextAPI, boolean] {
setResolvedRT(resolvedRT) setResolvedRT(resolvedRT)
} }
} }
resolveRTFacets() void resolveRTFacets()
return () => { return () => {
ignore = true ignore = true
} }