remove precacheThreadPostProfiles (#3729)
* remove `precacheThreadPostProfiles` * add `displayName` to `PreviewableUserAvatar` * memo * use `precacheProfile` * pass `profile` directly to `PreviewableUserAvatar` * update the `UserAvatar`'s props * remove feed cache * one more spot * rm unused queryClient * Don't call fn unnecessarily * Preload for display name too * try notification item * add to feeditem * and finally, precache for post threads * timestamp * Fix * onBeforePress --------- Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
This commit is contained in:
		
							parent
							
								
									ce85375c85
								
							
						
					
					
						commit
						7eb1444f2c
					
				
					 17 changed files with 119 additions and 168 deletions
				
			
		|  | @ -20,8 +20,7 @@ import {makeProfileLink} from 'lib/routes/links' | |||
| import {sanitizeDisplayName} from 'lib/strings/display-names' | ||||
| import {sanitizeHandle} from 'lib/strings/handles' | ||||
| import {s} from 'lib/styles' | ||||
| import {profileBasicQueryKey as RQKEY_PROFILE_BASIC} from 'state/queries/profile' | ||||
| import {RQKEY as RQKEY_URI} from 'state/queries/resolve-uri' | ||||
| import {precacheProfile} from 'state/queries/profile' | ||||
| import {Link} from '../util/Link' | ||||
| import {Text} from '../util/text/Text' | ||||
| import {PreviewableUserAvatar} from '../util/UserAvatar' | ||||
|  | @ -58,9 +57,7 @@ export function ProfileCard({ | |||
| 
 | ||||
|   const onBeforePress = React.useCallback(() => { | ||||
|     onPress?.() | ||||
| 
 | ||||
|     queryClient.setQueryData(RQKEY_URI(profile.handle), profile.did) | ||||
|     queryClient.setQueryData(RQKEY_PROFILE_BASIC(profile.did), profile) | ||||
|     precacheProfile(queryClient, profile) | ||||
|   }, [onPress, profile, queryClient]) | ||||
| 
 | ||||
|   if (!moderationOpts) { | ||||
|  | @ -91,9 +88,7 @@ export function ProfileCard({ | |||
|         <View style={styles.layoutAvi}> | ||||
|           <PreviewableUserAvatar | ||||
|             size={40} | ||||
|             did={profile.did} | ||||
|             handle={profile.handle} | ||||
|             avatar={profile.avatar} | ||||
|             profile={profile} | ||||
|             moderation={moderation.ui('avatar')} | ||||
|             type={isLabeler ? 'labeler' : 'user'} | ||||
|           /> | ||||
|  | @ -238,9 +233,7 @@ function FollowersList({ | |||
|           <View style={[styles.followedByAvi, pal.view]}> | ||||
|             <PreviewableUserAvatar | ||||
|               size={32} | ||||
|               did={f.did} | ||||
|               handle={f.handle} | ||||
|               avatar={f.avatar} | ||||
|               profile={f} | ||||
|               moderation={mod.ui('avatar')} | ||||
|               type={f.associated?.labeler ? 'labeler' : 'user'} | ||||
|             /> | ||||
|  |  | |||
|  | @ -220,8 +220,7 @@ function SuggestedFollow({ | |||
|         ]}> | ||||
|         <PreviewableUserAvatar | ||||
|           size={60} | ||||
|           did={profile.did} | ||||
|           handle={profile.handle} | ||||
|           profile={profile} | ||||
|           avatar={profile.avatar} | ||||
|           moderation={moderation.ui('avatar')} | ||||
|         /> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue