Merge branch 'main' into ansh/app-812-add-custom-feed-discovery-to-onboarding
commit
b38629b9b5
|
@ -122,7 +122,7 @@ export const FeedItem = observer(function ({
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.isReply || item.isMention || item.isQuote) {
|
if (item.isReply || item.isMention || item.isQuote) {
|
||||||
if (item.additionalPost?.error) {
|
if (!item.additionalPost || item.additionalPost?.error) {
|
||||||
// hide errors - it doesnt help the user to show them
|
// hide errors - it doesnt help the user to show them
|
||||||
return <View />
|
return <View />
|
||||||
}
|
}
|
||||||
|
@ -134,8 +134,7 @@ export const FeedItem = observer(function ({
|
||||||
noFeedback
|
noFeedback
|
||||||
accessible={false}>
|
accessible={false}>
|
||||||
<Post
|
<Post
|
||||||
uri={item.uri}
|
view={item.additionalPost}
|
||||||
initView={item.additionalPost}
|
|
||||||
style={
|
style={
|
||||||
item.isRead
|
item.isRead
|
||||||
? undefined
|
? undefined
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import React, {useRef} from 'react'
|
import React, {useRef} from 'react'
|
||||||
|
import {runInAction} from 'mobx'
|
||||||
import {observer} from 'mobx-react-lite'
|
import {observer} from 'mobx-react-lite'
|
||||||
import {
|
import {
|
||||||
ActivityIndicator,
|
ActivityIndicator,
|
||||||
|
@ -361,7 +362,9 @@ function* flattenThread(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!isAscending && !post.parent && post.post.replyCount) {
|
} else if (!isAscending && !post.parent && post.post.replyCount) {
|
||||||
post._hasMore = true
|
runInAction(() => {
|
||||||
|
post._hasMore = true
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import React, {useEffect, useState, useMemo} from 'react'
|
import React, {useState, useMemo} from 'react'
|
||||||
import {
|
import {
|
||||||
ActivityIndicator,
|
ActivityIndicator,
|
||||||
Linking,
|
Linking,
|
||||||
|
@ -32,35 +32,19 @@ import {getTranslatorLink, isPostInLanguage} from '../../../locale/helpers'
|
||||||
import {makeProfileLink} from 'lib/routes/links'
|
import {makeProfileLink} from 'lib/routes/links'
|
||||||
|
|
||||||
export const Post = observer(function Post({
|
export const Post = observer(function Post({
|
||||||
uri,
|
view,
|
||||||
initView,
|
|
||||||
showReplyLine,
|
showReplyLine,
|
||||||
hideError,
|
hideError,
|
||||||
style,
|
style,
|
||||||
}: {
|
}: {
|
||||||
uri: string
|
view: PostThreadModel
|
||||||
initView?: PostThreadModel
|
|
||||||
showReplyLine?: boolean
|
showReplyLine?: boolean
|
||||||
hideError?: boolean
|
hideError?: boolean
|
||||||
style?: StyleProp<ViewStyle>
|
style?: StyleProp<ViewStyle>
|
||||||
}) {
|
}) {
|
||||||
const pal = usePalette('default')
|
const pal = usePalette('default')
|
||||||
const store = useStores()
|
|
||||||
const [view, setView] = useState<PostThreadModel | undefined>(initView)
|
|
||||||
const [deleted, setDeleted] = useState(false)
|
const [deleted, setDeleted] = useState(false)
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (initView || view?.params.uri === uri) {
|
|
||||||
if (initView !== view) {
|
|
||||||
setView(initView)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const newView = new PostThreadModel(store, {uri, depth: 0})
|
|
||||||
setView(newView)
|
|
||||||
newView.setup().catch(err => store.log.error('Failed to fetch post', err))
|
|
||||||
}, [initView, setView, uri, view, view?.params.uri, store])
|
|
||||||
|
|
||||||
// deleted
|
// deleted
|
||||||
// =
|
// =
|
||||||
if (deleted) {
|
if (deleted) {
|
||||||
|
@ -69,11 +53,7 @@ export const Post = observer(function Post({
|
||||||
|
|
||||||
// loading
|
// loading
|
||||||
// =
|
// =
|
||||||
if (
|
if (!view.hasContent && view.isLoading) {
|
||||||
!view ||
|
|
||||||
(!view.hasContent && view.isLoading) ||
|
|
||||||
view.params.uri !== uri
|
|
||||||
) {
|
|
||||||
return (
|
return (
|
||||||
<View style={pal.view}>
|
<View style={pal.view}>
|
||||||
<ActivityIndicator />
|
<ActivityIndicator />
|
||||||
|
|
|
@ -72,12 +72,7 @@ const PostResults = observer(({model}: {model: SearchUIModel}) => {
|
||||||
return (
|
return (
|
||||||
<ScrollView style={[pal.view]}>
|
<ScrollView style={[pal.view]}>
|
||||||
{model.posts.map(post => (
|
{model.posts.map(post => (
|
||||||
<Post
|
<Post key={post.resolvedUri} view={post} hideError />
|
||||||
key={post.resolvedUri}
|
|
||||||
uri={post.resolvedUri}
|
|
||||||
initView={post}
|
|
||||||
hideError
|
|
||||||
/>
|
|
||||||
))}
|
))}
|
||||||
<View style={s.footerSpacer} />
|
<View style={s.footerSpacer} />
|
||||||
<View style={s.footerSpacer} />
|
<View style={s.footerSpacer} />
|
||||||
|
|
Loading…
Reference in New Issue