about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2024-05-20 20:13:06 -0700
committerGitHub <noreply@github.com>2024-05-20 20:13:06 -0700
commit8cec1679a718e0cc6da67cf2604e6be8e9dab9a7 (patch)
tree92a7b1e7abe6e66a6b58b6f2d8345d905c76959c /src
parent184c65836b3d966ca00433719a500029d6931a0e (diff)
downloadvoidsky-8cec1679a718e0cc6da67cf2604e6be8e9dab9a7.tar.zst
[🐴] only try to initialize once in the NUX (#4142)
* only try to initialize once

* nit
Diffstat (limited to 'src')
-rw-r--r--src/components/dms/MessagesNUX.tsx7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/components/dms/MessagesNUX.tsx b/src/components/dms/MessagesNUX.tsx
index 81d1cfff4..8d3b11fac 100644
--- a/src/components/dms/MessagesNUX.tsx
+++ b/src/components/dms/MessagesNUX.tsx
@@ -53,6 +53,8 @@ function DialogInner({
   const control = Dialog.useDialogContext()
   const {_} = useLingui()
   const t = useTheme()
+
+  const [initialized, setInitialzed] = React.useState(false)
   const {mutate: updateDeclaration} = useUpdateActorDeclaration({
     onError: () => {
       Toast.show(_(msg`Failed to update settings`))
@@ -69,10 +71,11 @@ function DialogInner({
   )
 
   useEffect(() => {
-    if (!chatDeclation) {
+    if (!chatDeclation && !initialized) {
       updateDeclaration('following')
+      setInitialzed(true)
     }
-  }, [chatDeclation, updateDeclaration])
+  }, [chatDeclation, updateDeclaration, initialized])
 
   return (
     <Dialog.ScrollableInner