Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
redux types: Add two assumeSecretlyGlobalState markings
In a bit, we'll make PerAccountState and GlobalState actually be distinct, and we'll mark most of our selectors as per-account or global accordingly. The major area of selectors we'll skip at first, because it requires some careful sorting-out of what its callers expect of it, is the selectors on `state.accounts` found in `accountsSelectors`. We'll initially say those are global selectors, reflecting the data that (like all our selectors) they have access to now in the status quo. Because we'll have GlobalState freely implicitly convert to PerAccountState (for a while) but not vice versa, that means that Flow will notice any place that a per-account selector (which has only a PerAccountState) invokes one of those selectors (which demands a GlobalState). We don't have many of those, but we have these two. In each of these cases, the calling selector really is working on a particular account's data, and although the data it's getting from the callee selector is stored in `state.accounts`, it really is specific to the active account; and in a multi-account future, the data we'll want here is really from whatever account the caller is working on, regardless of whether it's the active account in the UI. So these selectors are perfectly well doing the right thing; we just need to add these assumeSecretlyGlobalState markings, to tell Flow that we know about the type mismatch here and we're on it.
- Loading branch information