@@ -117,22 +117,30 @@ export type SessionState = $ReadOnly<{|
117
117
// PerAccountSessionState is inexact.)
118
118
(s: SessionState): PerAccountSessionState => s; // eslint-disable-line no-unused-expressions
119
119
120
- const initialState: SessionState = {
121
- eventQueueId: null,
122
-
120
+ const initialGlobalSessionState: $Exact<GlobalSessionState> = {
123
121
// This will be `null` on startup, while we wait to hear `true` or `false`
124
122
// from the native module over the RN bridge; so, have it start as `null`.
125
123
isOnline: null,
126
124
127
125
isHydrated: false,
128
- loading: false,
129
126
orientation: 'PORTRAIT',
130
- outboxSending: false,
131
127
pushToken: null,
132
128
debug: Object.freeze({}),
129
+ };
130
+
131
+ /** PRIVATE; exported only for tests. */
132
+ export const initialPerAccountSessionState: $Exact<PerAccountSessionState> = {
133
+ eventQueueId: null,
134
+ loading: false,
135
+ outboxSending: false,
133
136
hasDismissedServerCompatNotice: false,
134
137
};
135
138
139
+ const initialState: SessionState = {
140
+ ...initialGlobalSessionState,
141
+ ...initialPerAccountSessionState,
142
+ };
143
+
136
144
// eslint-disable-next-line default-param-last
137
145
export default (state: SessionState = initialState, action: Action): SessionState => {
138
146
switch (action.type) {
@@ -149,6 +157,9 @@ export default (state: SessionState = initialState, action: Action): SessionStat
149
157
case LOGIN_SUCCESS:
150
158
return {
151
159
...state,
160
+ loading: false,
161
+ outboxSending: false,
162
+ hasDismissedServerCompatNotice: false,
152
163
153
164
// We're about to request a new event queue; no use hanging on to
154
165
// any old one we might have.
@@ -159,6 +170,8 @@ export default (state: SessionState = initialState, action: Action): SessionStat
159
170
return {
160
171
...state,
161
172
loading: false,
173
+ outboxSending: false,
174
+ hasDismissedServerCompatNotice: false,
162
175
163
176
// Stop polling this event queue.
164
177
eventQueueId: null,
@@ -168,6 +181,8 @@ export default (state: SessionState = initialState, action: Action): SessionStat
168
181
return {
169
182
...state,
170
183
loading: false,
184
+ outboxSending: false,
185
+ hasDismissedServerCompatNotice: false,
171
186
172
187
// Stop polling this event queue. (We'll request a new one soon,
173
188
// for the new account.)
0 commit comments