Fix mobile account session selection
This commit is contained in:
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user