From 86155986af742c34e2acc0b3773f442eb7b23af5 Mon Sep 17 00:00:00 2001
From: dan <dan.abramov@gmail.com>
Date: Tue, 10 Dec 2024 21:19:53 +0000
Subject: Fix composer shortcut detaching a reply (#7041)

---
 src/state/shell/composer/index.tsx | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

(limited to 'src/state/shell/composer/index.tsx')

diff --git a/src/state/shell/composer/index.tsx b/src/state/shell/composer/index.tsx
index 9cac64426..7138945f4 100644
--- a/src/state/shell/composer/index.tsx
+++ b/src/state/shell/composer/index.tsx
@@ -83,7 +83,13 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
         'exclamation-circle',
       )
     } else {
-      setState(opts)
+      setState(prevOpts => {
+        if (prevOpts) {
+          // Never replace an already open composer.
+          return prevOpts
+        }
+        return opts
+      })
     }
   })
 
-- 
cgit 1.4.1

