Skip to content

Commit 94803bc

Browse files
committed
InitialNavigationDispatcher: Clarify and improve doInitialNavigation.
Staring at the code before this change, it's not clear why we'd want to go to the realm-input screen in the case where we know about exactly one account. That's the place we go when we don't have any idea what account the user might want to log in as. I suppose one might say it's weird to land on the account-picker screen when we only know about one account -- but we know that the account isn't logged in, so we can't go ahead and show its data. It also helps the user get where they're going faster by giving them something to tap on, which will take them to the auth screen to log in. See discussion [1]. [1] zulip#4274 (comment)
1 parent 1973bfe commit 94803bc

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/nav/InitialNavigationDispatcher.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,16 @@ class InitialNavigationDispatcher extends PureComponent<Props> {
4343
doInitialNavigation = () => {
4444
const { hasAuth, accounts, haveServerData, dispatch } = this.props;
4545

46+
// If we don't know about any accounts, go to the realm-input screen.
47+
if (accounts.length === 0) {
48+
dispatch(resetToRealmScreen({ initial: true }));
49+
return;
50+
}
51+
4652
// If the active account is not logged in, show account screen.
4753
if (!hasAuth) {
48-
if (accounts.length > 1) {
49-
dispatch(resetToAccountPicker());
50-
return;
51-
} else {
52-
dispatch(resetToRealmScreen({ initial: true }));
53-
return;
54-
}
54+
dispatch(resetToAccountPicker());
55+
return;
5556
}
5657

5758
// If there's an active, logged-in account but no server data, then behave

0 commit comments

Comments
 (0)