Fix mobile account session selection

This commit is contained in:
2026-06-29 22:01:41 -04:00
parent 9498a09b5b
commit b7eef743bd
9 changed files with 286 additions and 27 deletions
+3 -8
View File
@@ -67,7 +67,7 @@ export function AccountsProvider({ children }: { children: ReactNode }) {
setRuntimeApiUrl(active.instanceUrl);
} else if (draftUrl) {
setRuntimeApiUrl(draftUrl);
} else {
} else if (!process.env.EXPO_PUBLIC_API_URL?.trim()) {
setRuntimeApiUrl(DEFAULT_API_URL);
}
@@ -166,13 +166,8 @@ export function AccountsProvider({ children }: { children: ReactNode }) {
await saveAccounts(nextAccounts);
if (wasActive) {
const fallback = nextAccounts[0] ?? null;
await saveActiveAccountId(fallback?.id ?? null);
setActiveAccountId(fallback?.id ?? null);
if (fallback) {
setRuntimeApiUrl(fallback.instanceUrl);
setApiUrl(fallback.instanceUrl);
}
await saveActiveAccountId(null);
setActiveAccountId(null);
}
return { wasActive, remainingCount: nextAccounts.length };