@@ -27,7 +27,7 @@ import type {
27
27
UserPresence ,
28
28
UserStatusMapObject ,
29
29
} from './api/apiTypes' ;
30
- import type { SessionState } from './session/sessionReducer' ;
30
+ import type { PerAccountSessionState , SessionState } from './session/sessionReducer' ;
31
31
import type { PmConversationsState } from './pm-conversations/pmConversationsModel' ;
32
32
import type { UnreadState } from './unread/unreadModelTypes' ;
33
33
@@ -376,42 +376,29 @@ export type UsersState = $ReadOnlyArray<User>;
376
376
* parts of our code will in that future operate on a particular account and
377
377
* which parts will operate on all accounts' data or none.
378
378
*/
379
- // And *initially* initially, the type literally just is GlobalState.
380
- // That'll change in just a few commits, though.
381
- export type PerAccountState = GlobalState ;
379
+ export type PerAccountState = $ReadOnly < {
380
+ // TODO accounts
382
381
383
- /**
384
- * Our complete Redux state tree.
385
- *
386
- * Each property is a subtree maintained by its own reducer function. These
387
- * are named in a regular pattern; see also `src/boot/reducers.js`.
388
- *
389
- * We use `redux-persist` to write parts of this state tree to persistent
390
- * device storage that survives when the app is closed, and to read it back
391
- * ("rehydrate" it) from that storage at launch time. See `src/boot/store.js`.
392
- * Other parts of the state tree are not persisted.
393
- *
394
- * See in particular `discardKeys`, `storeKeys`, and `cacheKeys`, which
395
- * identify which subtrees are persisted and which are not.
396
- */
397
- export type GlobalState = $ReadOnly < { |
398
- accounts : AccountsState ,
382
+ // Jumbles of per-account state and client state.
383
+ session : PerAccountSessionState ,
384
+ settings : PerAccountSettingsState ,
385
+
386
+ // Per-account state that's *not* from the server.
387
+ drafts : DraftsState ,
388
+ outbox : OutboxState ,
389
+
390
+ // Per-account state: server data for the active account.
399
391
alertWords : AlertWordsState ,
400
392
caughtUp : CaughtUpState ,
401
- drafts : DraftsState ,
402
393
fetching : FetchingState ,
403
394
flags : FlagsState ,
404
395
messages : MessagesState ,
405
- migrations : MigrationsState ,
406
396
mute : MuteState ,
407
397
mutedUsers : MutedUsersState ,
408
398
narrows : NarrowsState ,
409
- outbox : OutboxState ,
410
399
pmConversations : PmConversationsState ,
411
400
presence : PresenceState ,
412
401
realm : RealmState ,
413
- session : SessionState ,
414
- settings : SettingsState ,
415
402
streams : StreamsState ,
416
403
subscriptions : SubscriptionsState ,
417
404
topics : TopicsState ,
@@ -420,6 +407,37 @@ export type GlobalState = $ReadOnly<{|
420
407
userGroups : UserGroupsState ,
421
408
userStatus : UserStatusState ,
422
409
users : UsersState ,
410
+
411
+ ...
412
+ } > ;
413
+
414
+ /**
415
+ * Our complete Redux state tree.
416
+ *
417
+ * Each property is a subtree maintained by its own reducer function. These
418
+ * are named in a regular pattern; see also `src/boot/reducers.js`.
419
+ *
420
+ * We use `redux-persist` to write parts of this state tree to persistent
421
+ * device storage that survives when the app is closed, and to read it back
422
+ * ("rehydrate" it) from that storage at launch time. See `src/boot/store.js`.
423
+ * Other parts of the state tree are not persisted.
424
+ *
425
+ * See in particular `discardKeys`, `storeKeys`, and `cacheKeys`, which
426
+ * identify which subtrees are persisted and which are not.
427
+ */
428
+ export type GlobalState = $ReadOnly < { |
429
+ ...$Exact < PerAccountState > ,
430
+
431
+ // Metadata for the global state, as persisted on disk.
432
+ migrations : MigrationsState ,
433
+
434
+ // Jumbles of per-account state and client state.
435
+ session : SessionState ,
436
+ settings : SettingsState ,
437
+
438
+ // Per-account state but for all accounts together.
439
+ // Mix of server data and otherwise.
440
+ accounts : AccountsState ,
423
441
| } > ;
424
442
425
443
// For now, under our single-active-account model, we want a GlobalState
@@ -436,7 +454,8 @@ export type GlobalState = $ReadOnly<{|
436
454
* TODO(#5006): We'll have to fix and eliminate each call to this.
437
455
*/
438
456
export function assumeSecretlyGlobalState ( state : PerAccountState ) : GlobalState {
439
- // For *right* now, this doesn't even have a fixme, because the types alias.
457
+ // $FlowFixMe[incompatible-exact]
458
+ // $FlowFixMe[prop-missing]
440
459
return state ;
441
460
}
442
461
0 commit comments