mirror of
https://github.com/bulwarkmail/native.git
synced 2026-10-31 16:06:32 +00:00
fix: open the composer before the session is up without crashing
This commit is contained in:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user