-
-
Notifications
You must be signed in to change notification settings - Fork 654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Store server data for multiple accounts at once #5005
Labels
a-data-sync
Zulip's event system, event queues, staleness/liveness
a-multi-org
a-redux
blocked on other work
To come back to after another related PR, or some other task.
P1 high-priority
Comments
gnprice
added
a-multi-org
a-redux
a-data-sync
Zulip's event system, event queues, staleness/liveness
P1 high-priority
blocked on other work
To come back to after another related PR, or some other task.
labels
Sep 16, 2021
This was referenced Sep 16, 2021
This was referenced Nov 9, 2021
chrisbobbe
added a commit
to chrisbobbe/zulip-mobile
that referenced
this issue
Dec 8, 2021
In a multi-account, post-zulip#5005 world, we're likely to want a live event queue for all the logged-in accounts. So we'll want this function to start polling for "this account", not for the global "active account". The action is already typed as a `ThunkAction`, not a `GlobalThunkAction`; that's a good start. The `auth` object we're working with after the code change is the same one as before, we just get it more directly. (`tryGetAuth` uses `getAccount`, which, pending zulip#5005, assumes "the account" is the active account; see the implementation comment in `getAccount`.) And, with zulip#5005, it will naturally change to be the Auth object for "this account", the one the caller cares about. Also expand a few comments and clarify that they only apply in the pre-zulip#5005 world, and add TODOs to remove them when we complete zulip#5005 so we don't forget.
chrisbobbe
added a commit
to chrisbobbe/zulip-mobile
that referenced
this issue
Mar 8, 2022
In a multi-account, post-zulip#5005 world, we're likely to want a live event queue for all the logged-in accounts. So we'll want this function to start polling for "this account", not for the global "active account". The action is already typed as a `ThunkAction`, not a `GlobalThunkAction`; that's a good start. The `auth` object we're working with after the code change is the same one as before, we just get it more directly. (`tryGetAuth` uses `getAccount`, which, pending zulip#5005, assumes "the account" is the active account; see the implementation comment in `getAccount`.) And, with zulip#5005, it will naturally change to be the Auth object for "this account", the one the caller cares about. Also expand a few comments and clarify that they only apply in the pre-zulip#5005 world, and add TODOs to remove them when we complete zulip#5005 so we don't forget.
chrisbobbe
added a commit
to chrisbobbe/zulip-mobile
that referenced
this issue
Mar 9, 2022
In a multi-account, post-zulip#5005 world, we're likely to want a live event queue for all the logged-in accounts. So we'll want this function to start polling for "this account", not for the global "active account". The action is already typed as a `ThunkAction`, not a `GlobalThunkAction`; that's a good start. The `auth` object we're working with after the code change is the same one as before, we just get it more directly. (`tryGetAuth` uses `getAccount`, which, pending zulip#5005, assumes "the account" is the active account; see the implementation comment in `getAccount`.) And, with zulip#5005, it will naturally change to be the Auth object for "this account", the one the caller cares about.
chrisbobbe
added a commit
to chrisbobbe/zulip-mobile
that referenced
this issue
Mar 12, 2022
In a multi-account, post-zulip#5005 world, we're likely to want a live event queue for all the logged-in accounts. So we'll want this function to start polling for "this account", not for the global "active account". The action is already typed as a `ThunkAction`, not a `GlobalThunkAction`; that's a good start. The `auth` object we're working with after the code change is the same one as before, we just get it more directly. (`tryGetAuth` uses `getAccount`, which, pending zulip#5005, assumes "the account" is the active account; see the implementation comment in `getAccount`.) And, with zulip#5005, it will naturally change to be the Auth object for "this account", the one the caller cares about.
gnprice
pushed a commit
to chrisbobbe/zulip-mobile
that referenced
this issue
Mar 12, 2022
In a multi-account, post-zulip#5005 world, we're likely to want a live event queue for all the logged-in accounts. So we'll want this function to start polling for "this account", not for the global "active account". The action is already typed as a `ThunkAction`, not a `GlobalThunkAction`; that's a good start. The `auth` object we're working with after the code change is the same one as before, we just get it more directly. (`tryGetAuth` uses `getAccount`, which, pending zulip#5005, assumes "the account" is the active account; see the implementation comment in `getAccount`.) And, with zulip#5005, it will naturally change to be the Auth object for "this account", the one the caller cares about.
chrisbobbe
added a commit
to chrisbobbe/zulip-mobile
that referenced
this issue
Dec 13, 2022
Most of these state subtrees hold per-account data we get from the server. In the current pre-zulip#5005 design, where we only store server data for one account, these should already have been clearing out on LOGIN_SUCCESS, like we do with messages, narrows, etc. Two of the subtrees, `outbox` and `drafts`, hold client-side per-account data. Just as with server data, we've only been keeping these around for the active account, and like the other reducers touched in this commit, we've forgotten to handle LOGIN_SUCCESS for them. So, do that. Now, all the server-data subtrees and `outbox` and `drafts` all reset on ACCOUNT_SWITCH, LOGIN_SUCCESS, and LOGOUT. That's part of Greg's proposed fix for zulip#4446. Next, we'll do the next part: > * I think it'd be a useful refactor to consolidate one action type > like `CLEAR_ACCOUNT_DATA`. > * The action creators for these three (in `accountActions.js`) can > dispatch that first, then also a `LOGOUT` etc. > * Almost all the reducers would respond only to the > `CLEAR_ACCOUNT_DATA`. > * There are a couple of exceptions, like `accountReducers` and > `sessionReducers`, that actually want to treat the three cases > differently. Those would be the only ones to continue responding > to `LOGOUT` etc.; and they'd stand out better as a result. > * Then there are further changes we might make to those, but > that'll be easier to see after that. Fixes-partly: zulip#4446
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
a-data-sync
Zulip's event system, event queues, staleness/liveness
a-multi-org
a-redux
blocked on other work
To come back to after another related PR, or some other task.
P1 high-priority
Currently we store almost all data from the server -- things like what other users exist, what streams, what messages, and how many unreads you have -- for just one account at a time, the "active account" (see our glossary). When you switch to look at another account, that one becomes the active account, and we discard the data from the previously active account.
Instead, we should maintain all this data for all the user's accounts, all the accounts they're logged into.
This is a prerequisite for many of our issues in the "multi-org" area. In particular it's necessary for:
and helpful or likely-necessary for:
state.accounts
like we currently do forzulip_version
and a few others, but that is a workaround)We don't have to do this all at once. We can have intermediate states where some parts of the server data are kept only for the active account, and others are kept for all accounts.
In fact the status quo is such an intermediate state: we keep a handful of small pieces of server data in
state.accounts
, which is the one place that currently keeps data for all accounts. These include the Zulip server version and feature level, and the user's user ID.Prerequisites for fully doing this include:
We'll want to stop reloading the server data from scratch on app launch. As Store persistent data in a sound way #4841 explains, we currently rely on that to limit the consequences of some major issues in how we maintain the data. As Store persistent data in a sound way #4841 says:
In order to do without that reloading, we'll need to fix:
To get the full benefit, we'll also need to do Support downgrading to a long-lived event queue #3916 in order to maintain each server's data over hours, days, and weeks with the app in the background.
We'll need to do some rearranging of how our data appears both in Redux and in persistent storage, because the existing schemas are built on the assumption of a single active account. I've filed this as Multi-org-compatible schemas for data in Redux and persistent store #5006.
The text was updated successfully, but these errors were encountered: