Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
navReducer: Better decide if we have server data in
rehydrate
.
As hinted by the comment above this edit, even an empty array is incomplete server data: "Valid server data must have a user: the self user, at a minimum.". But the initial state of `users` (`initialState` in src/users/usersReducer.js) is an empty array. LOGOUT, LOGIN_SUCCESS, and ACCOUNT_SWITCH all set `users` to that initial state. Those three actions are handled in `navReducer` by navigating to routes that don't depend on complete server data: 'loading' or 'account'. But if we quit the app with `users` having this initial state (e.g., giving up in frustration while trying to connect to a realm for a long time), we should be sure that, on reopening it and rehydrating, we don't try to go to 'main' before that initial state has been replaced with a complete state. Otherwise, we see "No server data found" errors and a white screen. See also discussion [1]. [1]: https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/.23M4166.20Time.20out.20initial.20fetch/near/912017
- Loading branch information