about summary refs log tree commit diff
path: root/src/view/com/post-thread/PostThread.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/view/com/post-thread/PostThread.tsx')
-rw-r--r--src/view/com/post-thread/PostThread.tsx26
1 files changed, 8 insertions, 18 deletions
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 />