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/PostThread.tsx | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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

diff --git a/src/view/screens/PostThread.tsx b/src/view/screens/PostThread.tsx
index eb8ac9eb4..c14c93af0 100644
--- a/src/view/screens/PostThread.tsx
+++ b/src/view/screens/PostThread.tsx
@@ -25,8 +25,9 @@ export const PostThread = ({navIdx, visible, params}: ScreenParams) => {
   }
   useEffect(() => {
     let aborted = false
+    const threadCleanup = view.registerListeners()
     if (!visible) {
-      return
+      return threadCleanup
     }
     setTitle()
     store.shell.setMinimalShellMode(false)
@@ -44,6 +45,7 @@ export const PostThread = ({navIdx, visible, params}: ScreenParams) => {
     }
     return () => {
       aborted = true
+      threadCleanup()
     }
   }, [visible, store.nav, store.log, name])
 
-- 
cgit 1.4.1

