···9999 <View style={[a.py_lg]}>
100100 <Text
101101 style={[
102102- t.atoms.text,
102102+ t.atoms.text_contrast_medium,
103103 a.text_sm,
104104 a.font_semi_bold,
105105- {opacity: 0.7}, // NOTE: we use opacity 0.7 instead of a color to match the color of the home pager tab bar
106105 ]}>
107106 {topic.topic}
108107 </Text>
+45
src/state/queries/profile.ts
···44 type AppBskyActorGetProfile,
55 type AppBskyActorGetProfiles,
66 type AppBskyActorProfile,
77+ type AppBskyGraphGetFollows,
78 AtUri,
89 type BskyAgent,
910 type ComAtprotoRepoUploadBlob,
1011 type Un$Typed,
1112} from '@atproto/api'
1213import {
1414+ type InfiniteData,
1315 keepPreviousData,
1416 type QueryClient,
1517 useMutation,
···2628import {type ImageMeta} from '#/state/gallery'
2729import {STALE} from '#/state/queries'
2830import {resetProfilePostsQueries} from '#/state/queries/post-feed'
3131+import {RQKEY as PROFILE_FOLLOWS_RQKEY} from '#/state/queries/profile-follows'
2932import {
3033 unstableCacheProfileView,
3134 useUnstableProfileViewCache,
···247250) {
248251 const agent = useAgent()
249252 const queryClient = useQueryClient()
253253+ const {currentAccount} = useSession()
250254 const did = profile.did
251255 const initialFollowingUri = profile.viewer?.following
252256 const followMutation = useProfileFollowMutation(
···282286 updateProfileShadow(queryClient, did, {
283287 followingUri: finalFollowingUri,
284288 })
289289+290290+ // Optimistically update profile follows cache for avatar displays
291291+ if (currentAccount?.did) {
292292+ type FollowsQueryData =
293293+ InfiniteData<AppBskyGraphGetFollows.OutputSchema>
294294+ queryClient.setQueryData<FollowsQueryData>(
295295+ PROFILE_FOLLOWS_RQKEY(currentAccount.did),
296296+ old => {
297297+ if (!old?.pages?.[0]) return old
298298+ if (finalFollowingUri) {
299299+ // Add the followed profile to the beginning
300300+ const alreadyExists = old.pages[0].follows.some(
301301+ f => f.did === profile.did,
302302+ )
303303+ if (alreadyExists) return old
304304+ return {
305305+ ...old,
306306+ pages: [
307307+ {
308308+ ...old.pages[0],
309309+ follows: [
310310+ profile as AppBskyActorDefs.ProfileView,
311311+ ...old.pages[0].follows,
312312+ ],
313313+ },
314314+ ...old.pages.slice(1),
315315+ ],
316316+ }
317317+ } else {
318318+ // Remove the unfollowed profile
319319+ return {
320320+ ...old,
321321+ pages: old.pages.map(page => ({
322322+ ...page,
323323+ follows: page.follows.filter(f => f.did !== profile.did),
324324+ })),
325325+ }
326326+ }
327327+ },
328328+ )
329329+ }
285330286331 if (finalFollowingUri) {
287332 agent.app.bsky.graph