From ebc2033d186af6cf81f9533082857ee4a8fa6822 Mon Sep 17 00:00:00 2001
From: Paul Frazee <pfrazee@gmail.com>
Date: Wed, 18 Jan 2023 16:45:48 -0600
Subject: Handle post deletions by removing from active views (close #37)

---
 src/view/screens/Profile.tsx | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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

diff --git a/src/view/screens/Profile.tsx b/src/view/screens/Profile.tsx
index a3e3ecd33..d701fba0d 100644
--- a/src/view/screens/Profile.tsx
+++ b/src/view/screens/Profile.tsx
@@ -31,8 +31,9 @@ export const Profile = observer(({navIdx, visible, params}: ScreenParams) => {
 
   useEffect(() => {
     let aborted = false
+    const feedCleanup = uiState.feed.registerListeners()
     if (!visible) {
-      return
+      return feedCleanup
     }
     if (hasSetup) {
       uiState.update()
@@ -45,6 +46,7 @@ export const Profile = observer(({navIdx, visible, params}: ScreenParams) => {
     }
     return () => {
       aborted = true
+      feedCleanup()
     }
   }, [visible, params.name, store])
 
-- 
cgit 1.4.1

