Pārlūkot izejas kodu

[RN] Fix redux state cleanup

The preceding commit "fix(auth.native): trigger conference left on
cancel" did not correctly clean the redux state up on CONFERENCE_LEFT.
j8
Lyubo Marinov 8 gadus atpakaļ
vecāks
revīzija
499ee7985b

+ 8
- 3
react/features/authentication/actions.js Parādīt failu

@@ -84,11 +84,16 @@ export function cancelLogin() {
84 84
 export function cancelWaitForOwner() {
85 85
     return (dispatch: Dispatch<*>, getState: Function) => {
86 86
         dispatch(stopWaitForOwner());
87
+
88
+        // XXX The error associated with CONFERENCE_FAILED was marked as
89
+        // recoverable by the feature room-lock and, consequently,
90
+        // recoverable-aware features such as mobile's external-api did not
91
+        // deliver the CONFERENCE_FAILED to the SDK clients/consumers. Since the
92
+        // app/user is going to nativate to WelcomePage, the SDK
93
+        // clients/consumers need an event.
87 94
         const { authRequired } = getState()['features/base/conference'];
88 95
 
89
-        if (authRequired) {
90
-            dispatch(conferenceLeft(authRequired));
91
-        }
96
+        authRequired && dispatch(conferenceLeft(authRequired));
92 97
 
93 98
         dispatch(appNavigate(undefined));
94 99
     };

+ 13
- 10
react/features/base/conference/reducer.js Parādīt failu

@@ -183,31 +183,34 @@ function _conferenceJoined(state, { conference }) {
183 183
  * reduction of the specified action.
184 184
  */
185 185
 function _conferenceLeft(state, { conference }) {
186
-    let output = state;
186
+    let nextState = state;
187 187
 
188 188
     if (state.authRequired === conference) {
189
-        output = set(output, 'authRequired', undefined);
189
+        nextState = set(nextState, 'authRequired', undefined);
190 190
     }
191 191
     if (state.conference === conference) {
192
-        output = assign(output, {
192
+        nextState = assign(nextState, {
193 193
             conference: undefined,
194 194
             joining: undefined,
195
-            leaving: undefined
195
+            leaving: undefined,
196
+
197
+            // XXX Clear/unset locked & password here for a conference which has
198
+            // been LOCKED_LOCALLY.
199
+            locked: undefined,
200
+            password: undefined
196 201
         });
197 202
     }
198 203
     if (state.passwordRequired === conference) {
199
-        // Note that in case the conference was joined those fields have been
200
-        // cleared already, so this step needs to be done only if the room
201
-        // unlock operation has been canceled and that's why it's not done in
202
-        // the 'state.conference' condition above.
203
-        output = assign(output, {
204
+        nextState = assign(nextState, {
205
+            // XXX Clear/unset locked & password here for a conference which has
206
+            // been LOCKED_REMOTELY.
204 207
             locked: undefined,
205 208
             password: undefined,
206 209
             passwordRequired: undefined
207 210
         });
208 211
     }
209 212
 
210
-    return output;
213
+    return nextState;
211 214
 }
212 215
 
213 216
 /**

Notiek ielāde…
Atcelt
Saglabāt