From f36c9565362b741c58672204fe0c155252affe28 Mon Sep 17 00:00:00 2001
From: Paul Frazee <pfrazee@gmail.com>
Date: Tue, 24 Jan 2023 13:00:11 -0600
Subject: 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
---
 src/view/screens/Profile.tsx | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

(limited to 'src/view/screens/Profile.tsx')

diff --git a/src/view/screens/Profile.tsx b/src/view/screens/Profile.tsx
index bd60ca61c..7fd813809 100644
--- a/src/view/screens/Profile.tsx
+++ b/src/view/screens/Profile.tsx
@@ -26,9 +26,13 @@ export const Profile = observer(({navIdx, visible, params}: ScreenParams) => {
   const [hasSetup, setHasSetup] = useState<boolean>(false)
   const uiState = React.useMemo(
     () => new ProfileUiModel(store, {user: params.name}),
-    [params.user],
+    [params.name, store],
   )
 
+  useEffect(() => {
+    store.nav.setTitle(navIdx, params.name)
+  }, [store, navIdx, params.name])
+
   useEffect(() => {
     let aborted = false
     const feedCleanup = uiState.feed.registerListeners()
@@ -38,7 +42,6 @@ export const Profile = observer(({navIdx, visible, params}: ScreenParams) => {
     if (hasSetup) {
       uiState.update()
     } else {
-      store.nav.setTitle(navIdx, params.name)
       uiState.setup().then(() => {
         if (aborted) {
           return
@@ -50,7 +53,7 @@ export const Profile = observer(({navIdx, visible, params}: ScreenParams) => {
       aborted = true
       feedCleanup()
     }
-  }, [visible, params.name, store])
+  }, [visible, store, hasSetup, uiState])
 
   // events
   // =
@@ -139,7 +142,7 @@ export const Profile = observer(({navIdx, visible, params}: ScreenParams) => {
             <EmptyState
               icon={['far', 'message']}
               message="No posts yet!"
-              style={{paddingVertical: 40}}
+              style={styles.emptyState}
             />
           )
         }
@@ -187,7 +190,7 @@ export const Profile = observer(({navIdx, visible, params}: ScreenParams) => {
 
 function LoadingMoreFooter() {
   return (
-    <View style={{paddingVertical: 20}}>
+    <View style={styles.loadingMoreFooter}>
       <ActivityIndicator />
     </View>
   )
@@ -202,6 +205,12 @@ const styles = StyleSheet.create({
     paddingVertical: 10,
     paddingHorizontal: 14,
   },
+  emptyState: {
+    paddingVertical: 40,
+  },
+  loadingMoreFooter: {
+    paddingVertical: 20,
+  },
   endItem: {
     paddingTop: 20,
     paddingBottom: 30,
-- 
cgit 1.4.1

