From 76d4bc754be41fa0d80e42a7734f4febc16955cc Mon Sep 17 00:00:00 2001 From: xmflsct Date: Wed, 11 Jan 2023 22:18:02 +0100 Subject: [PATCH] Fix accounts array empty not init --- src/components/Instance/index.tsx | 2 +- src/screens/Compose/Root/Header/PostingAs.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Instance/index.tsx b/src/components/Instance/index.tsx index 39718ce0..9b53312d 100644 --- a/src/components/Instance/index.tsx +++ b/src/components/Instance/index.tsx @@ -184,7 +184,7 @@ const ComponentInstance: React.FC = ({ ) if (!account) { - setGlobalStorage('accounts', accounts?.concat([accountKey])) + setGlobalStorage('accounts', (accounts || []).concat([accountKey])) } setAccount(accountKey) diff --git a/src/screens/Compose/Root/Header/PostingAs.tsx b/src/screens/Compose/Root/Header/PostingAs.tsx index cc79dbbe..4079b0ab 100644 --- a/src/screens/Compose/Root/Header/PostingAs.tsx +++ b/src/screens/Compose/Root/Header/PostingAs.tsx @@ -7,8 +7,8 @@ import { useTranslation } from 'react-i18next' import { View } from 'react-native' const ComposePostingAs = () => { - const accounts = useGlobalStorage.object('accounts') - if (!accounts.length) return null + const [accounts] = useGlobalStorage.object('accounts') + if (!accounts?.length) return null const { t } = useTranslation('screenCompose') const { colors } = useTheme()