From 5dcf5991ab4045fa304927fd8a09acb8879da790 Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Sat, 26 Sep 2026 01:46:42 +0200 Subject: [PATCH] fix: open the composer before the session is up without crashing --- src/screens/ComposeScreen.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/screens/ComposeScreen.tsx b/src/screens/ComposeScreen.tsx index 9bdc58da..b04ea684 100644 --- a/src/screens/ComposeScreen.tsx +++ b/src/screens/ComposeScreen.tsx @@ -882,7 +882,10 @@ export default function ComposeScreen({ route, navigation }: Props) { React.useEffect(() => { if (selectedIdentityId || identities.length === 0) return; const activeEmail = useAccountStore.getState().getActiveAccount()?.email || jmapClient.username; - const preferredId = preferredIdentityIds[jmapClient.accountId]; + // Identities can come from the offline cache before the session is up, + // when the throwing `accountId` getter would crash the screen. + const connectedAccountId = jmapClient.connectedAccountId; + const preferredId = connectedAccountId ? preferredIdentityIds[connectedAccountId] : undefined; const defaultIdentity = identities.find((i) => i.id === preferredId) ?? identities.find((i) => i.email.toLowerCase() === activeEmail?.toLowerCase())