[🐴] only try to initialize once in the NUX (#4142)

* only try to initialize once

* nit
zio/stable
Hailey 2024-05-20 20:13:06 -07:00 committed by GitHub
parent 184c65836b
commit 8cec1679a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 2 deletions

View File

@ -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