Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Remove ability for Post component to load from URI (close #1302) (#1317)

authored by

Paul Frazee and committed by
GitHub
e2f0770b c77fd588

+7 -33
+2 -3
src/view/com/notifications/FeedItem.tsx
··· 122 122 } 123 123 124 124 if (item.isReply || item.isMention || item.isQuote) { 125 - if (item.additionalPost?.error) { 125 + if (!item.additionalPost || item.additionalPost?.error) { 126 126 // hide errors - it doesnt help the user to show them 127 127 return <View /> 128 128 } ··· 134 134 noFeedback 135 135 accessible={false}> 136 136 <Post 137 - uri={item.uri} 138 - initView={item.additionalPost} 137 + view={item.additionalPost} 139 138 style={ 140 139 item.isRead 141 140 ? undefined
+4 -24
src/view/com/post/Post.tsx
··· 1 - import React, {useEffect, useState, useMemo} from 'react' 1 + import React, {useState, useMemo} from 'react' 2 2 import { 3 3 ActivityIndicator, 4 4 Linking, ··· 32 32 import {makeProfileLink} from 'lib/routes/links' 33 33 34 34 export const Post = observer(function Post({ 35 - uri, 36 - initView, 35 + view, 37 36 showReplyLine, 38 37 hideError, 39 38 style, 40 39 }: { 41 - uri: string 42 - initView?: PostThreadModel 40 + view: PostThreadModel 43 41 showReplyLine?: boolean 44 42 hideError?: boolean 45 43 style?: StyleProp<ViewStyle> 46 44 }) { 47 45 const pal = usePalette('default') 48 - const store = useStores() 49 - const [view, setView] = useState<PostThreadModel | undefined>(initView) 50 46 const [deleted, setDeleted] = useState(false) 51 47 52 - useEffect(() => { 53 - if (initView || view?.params.uri === uri) { 54 - if (initView !== view) { 55 - setView(initView) 56 - } 57 - return 58 - } 59 - const newView = new PostThreadModel(store, {uri, depth: 0}) 60 - setView(newView) 61 - newView.setup().catch(err => store.log.error('Failed to fetch post', err)) 62 - }, [initView, setView, uri, view, view?.params.uri, store]) 63 - 64 48 // deleted 65 49 // = 66 50 if (deleted) { ··· 69 53 70 54 // loading 71 55 // = 72 - if ( 73 - !view || 74 - (!view.hasContent && view.isLoading) || 75 - view.params.uri !== uri 76 - ) { 56 + if (!view.hasContent && view.isLoading) { 77 57 return ( 78 58 <View style={pal.view}> 79 59 <ActivityIndicator />
+1 -6
src/view/com/search/SearchResults.tsx
··· 72 72 return ( 73 73 <ScrollView style={[pal.view]}> 74 74 {model.posts.map(post => ( 75 - <Post 76 - key={post.resolvedUri} 77 - uri={post.resolvedUri} 78 - initView={post} 79 - hideError 80 - /> 75 + <Post key={post.resolvedUri} view={post} hideError /> 81 76 ))} 82 77 <View style={s.footerSpacer} /> 83 78 <View style={s.footerSpacer} />