Browse Source

[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 years ago
parent
commit
499ee7985b
2 changed files with 21 additions and 13 deletions
  1. 8
    3
      react/features/authentication/actions.js
  2. 13
    10
      react/features/base/conference/reducer.js

+ 8
- 3
react/features/authentication/actions.js View File

84
 export function cancelWaitForOwner() {
84
 export function cancelWaitForOwner() {
85
     return (dispatch: Dispatch<*>, getState: Function) => {
85
     return (dispatch: Dispatch<*>, getState: Function) => {
86
         dispatch(stopWaitForOwner());
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
         const { authRequired } = getState()['features/base/conference'];
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
         dispatch(appNavigate(undefined));
98
         dispatch(appNavigate(undefined));
94
     };
99
     };

+ 13
- 10
react/features/base/conference/reducer.js View File

183
  * reduction of the specified action.
183
  * reduction of the specified action.
184
  */
184
  */
185
 function _conferenceLeft(state, { conference }) {
185
 function _conferenceLeft(state, { conference }) {
186
-    let output = state;
186
+    let nextState = state;
187
 
187
 
188
     if (state.authRequired === conference) {
188
     if (state.authRequired === conference) {
189
-        output = set(output, 'authRequired', undefined);
189
+        nextState = set(nextState, 'authRequired', undefined);
190
     }
190
     }
191
     if (state.conference === conference) {
191
     if (state.conference === conference) {
192
-        output = assign(output, {
192
+        nextState = assign(nextState, {
193
             conference: undefined,
193
             conference: undefined,
194
             joining: undefined,
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
     if (state.passwordRequired === conference) {
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
             locked: undefined,
207
             locked: undefined,
205
             password: undefined,
208
             password: undefined,
206
             passwordRequired: undefined
209
             passwordRequired: undefined
207
         });
210
         });
208
     }
211
     }
209
 
212
 
210
-    return output;
213
+    return nextState;
211
 }
214
 }
212
 
215
 
213
 /**
216
 /**

Loading…
Cancel
Save