From 89e7a9929247ad76ac7a740a071d3d32e8bacd59 Mon Sep 17 00:00:00 2001
From: Paul Frazee <pfrazee@gmail.com>
Date: Thu, 17 Nov 2022 16:26:00 -0600
Subject: Fix post thread title

---
 src/view/com/post-thread/PostThread.tsx | 26 ++++++++------------------
 1 file changed, 8 insertions(+), 18 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 ee87a6bff..6b7f96e06 100644
--- a/src/view/com/post-thread/PostThread.tsx
+++ b/src/view/com/post-thread/PostThread.tsx
@@ -10,20 +10,14 @@ import {SharePostModel} from '../../../state/models/shell-ui'
 import {PostThreadItem} from './PostThreadItem'
 import {ErrorMessage} from '../util/ErrorMessage'
 
-export const PostThread = observer(function PostThread({uri}: {uri: string}) {
+export const PostThread = observer(function PostThread({
+  uri,
+  view,
+}: {
+  uri: string
+  view: PostThreadViewModel
+}) {
   const store = useStores()
-  const [view, setView] = useState<PostThreadViewModel | undefined>()
-
-  useEffect(() => {
-    if (view?.params.uri === uri) {
-      console.log('Post thread doing nothing')
-      return // no change needed? or trigger refresh?
-    }
-    console.log('Fetching post thread', uri)
-    const newView = new PostThreadViewModel(store, {uri})
-    setView(newView)
-    newView.setup().catch(err => console.error('Failed to fetch thread', err))
-  }, [uri, view?.params.uri, store])
 
   const onPressShare = (uri: string) => {
     store.shell.openModal(new SharePostModel(uri))
@@ -34,11 +28,7 @@ export const PostThread = observer(function PostThread({uri}: {uri: string}) {
 
   // loading
   // =
-  if (
-    !view ||
-    (view.isLoading && !view.isRefreshing) ||
-    view.params.uri !== uri
-  ) {
+  if ((view.isLoading && !view.isRefreshing) || view.params.uri !== uri) {
     return (
       <View>
         <ActivityIndicator />
-- 
cgit 1.4.1

