about summary refs log tree commit diff
path: root/src/view/screens/PostThread.tsx
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-01-24 13:00:11 -0600
committerGitHub <noreply@github.com>2023-01-24 13:00:11 -0600
commitf36c9565362b741c58672204fe0c155252affe28 (patch)
tree85d90f3caae2c8f2103ec50346f9274cf8b243c5 /src/view/screens/PostThread.tsx
parent3a90114f3afc66cfef70c71c2ee343c29e1f3e8d (diff)
downloadvoidsky-f36c9565362b741c58672204fe0c155252affe28.tar.zst
Resolve all remaining lint issues (#88)
* Rework 'navIdx' variables from number arrays to strings to avoid equality-check failures in react hooks

* Resolve all remaining lint issues

* Fix tests

* Use node v18 in gh action test
Diffstat (limited to 'src/view/screens/PostThread.tsx')
-rw-r--r--src/view/screens/PostThread.tsx21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/view/screens/PostThread.tsx b/src/view/screens/PostThread.tsx
index c14c93af0..febaddc09 100644
--- a/src/view/screens/PostThread.tsx
+++ b/src/view/screens/PostThread.tsx
@@ -6,6 +6,7 @@ import {PostThread as PostThreadComponent} from '../com/post-thread/PostThread'
 import {PostThreadViewModel} from '../../state/models/post-thread-view'
 import {ScreenParams} from '../routes'
 import {useStores} from '../../state'
+import {s} from '../lib/styles'
 
 export const PostThread = ({navIdx, visible, params}: ScreenParams) => {
   const store = useStores()
@@ -14,18 +15,18 @@ export const PostThread = ({navIdx, visible, params}: ScreenParams) => {
   const uri = makeRecordUri(name, 'app.bsky.feed.post', rkey)
   const view = useMemo<PostThreadViewModel>(
     () => new PostThreadViewModel(store, {uri}),
-    [uri],
+    [store, uri],
   )
 
-  const setTitle = () => {
-    const author = view.thread?.author
-    const niceName = author?.handle || name
-    setViewSubtitle(`by ${niceName}`)
-    store.nav.setTitle(navIdx, `Post by ${niceName}`)
-  }
   useEffect(() => {
     let aborted = false
     const threadCleanup = view.registerListeners()
+    const setTitle = () => {
+      const author = view.thread?.post.author
+      const niceName = author?.handle || name
+      setViewSubtitle(`by ${niceName}`)
+      store.nav.setTitle(navIdx, `Post by ${niceName}`)
+    }
     if (!visible) {
       return threadCleanup
     }
@@ -47,12 +48,12 @@ export const PostThread = ({navIdx, visible, params}: ScreenParams) => {
       aborted = true
       threadCleanup()
     }
-  }, [visible, store.nav, store.log, name])
+  }, [visible, store.nav, store.log, store.shell, name, navIdx, view])
 
   return (
-    <View style={{flex: 1}}>
+    <View style={s.h100pct}>
       <ViewHeader title="Post" subtitle={viewSubtitle} />
-      <View style={{flex: 1}}>
+      <View style={s.h100pct}>
         <PostThreadComponent uri={uri} view={view} />
       </View>
     </View>