From e7d971410f080f3dd748655eaa0e306bd0031d78 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Tue, 20 Dec 2022 22:54:56 -0600 Subject: Update to use new getTimeline, getAuthorFeed, and getPostThread output models --- src/view/com/post-thread/PostThread.tsx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/view/com/post-thread/PostThread.tsx') diff --git a/src/view/com/post-thread/PostThread.tsx b/src/view/com/post-thread/PostThread.tsx index 0df505a74..ecc0d48f5 100644 --- a/src/view/com/post-thread/PostThread.tsx +++ b/src/view/com/post-thread/PostThread.tsx @@ -1,11 +1,10 @@ import React, {useRef} from 'react' import {observer} from 'mobx-react-lite' -import {ActivityIndicator, FlatList, Text, View} from 'react-native' +import {ActivityIndicator, FlatList, View} from 'react-native' import { PostThreadViewModel, PostThreadViewPostModel, } from '../../../state/models/post-thread-view' -import {useStores} from '../../../state' import {PostThreadItem} from './PostThreadItem' import {ErrorMessage} from '../util/ErrorMessage' @@ -93,14 +92,22 @@ function* flattenThread( isAscending = false, ): Generator { if (post.parent) { - yield* flattenThread(post.parent, true) + if ('notFound' in post.parent && post.parent.notFound) { + // TODO render not found + } else { + yield* flattenThread(post.parent as PostThreadViewPostModel, true) + } } yield post if (post.replies?.length) { for (const reply of post.replies) { - yield* flattenThread(reply) + if ('notFound' in reply && reply.notFound) { + // TODO render not found + } else { + yield* flattenThread(reply as PostThreadViewPostModel) + } } - } else if (!isAscending && !post.parent && post.replyCount > 0) { + } else if (!isAscending && !post.parent && post.post.replyCount > 0) { post._hasMore = true } } -- cgit 1.4.1