diff options
author | Paul Frazee <pfrazee@gmail.com> | 2022-11-17 16:26:00 -0600 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2022-11-17 16:26:00 -0600 |
commit | 89e7a9929247ad76ac7a740a071d3d32e8bacd59 (patch) | |
tree | 9413d18c8977afa19d6388c8f416c17119fcab9e /src/view/com/post-thread/PostThread.tsx | |
parent | ab2e0ab88f666d13a34c2883f0db8c955d1d45cb (diff) | |
download | voidsky-89e7a9929247ad76ac7a740a071d3d32e8bacd59.tar.zst |
Fix post thread title
Diffstat (limited to 'src/view/com/post-thread/PostThread.tsx')
-rw-r--r-- | src/view/com/post-thread/PostThread.tsx | 26 |
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 /> |