Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

[RN] Fix redux state cleanup

Lyubo Marinov499ee7985bd9
diff --git a/react/features/authentication/actions.js b/react/features/authentication/actions.js
index b0ec8077e5..396bb994f3 100644
--- a/react/features/authentication/actions.js
+++ b/react/features/authentication/actions.js
@@ -84,11 +84,16 @@ export function cancelLogin() {
export function cancelWaitForOwner() {
return (dispatch: Dispatch<*>, getState: Function) => {
dispatch(stopWaitForOwner());
+
+ // XXX The error associated with CONFERENCE_FAILED was marked as
+ // recoverable by the feature room-lock and, consequently,
+ // recoverable-aware features such as mobile's external-api did not
+ // deliver the CONFERENCE_FAILED to the SDK clients/consumers. Since the
+ // app/user is going to nativate to WelcomePage, the SDK
+ // clients/consumers need an event.
const { authRequired } = getState()['features/base/conference'];
- if (authRequired) {
- dispatch(conferenceLeft(authRequired));
- }
+ authRequired && dispatch(conferenceLeft(authRequired));
dispatch(appNavigate(undefined));
};
diff --git a/react/features/base/conference/reducer.js b/react/features/base/conference/reducer.js
index 2b3bf81149..387317a763 100644
--- a/react/features/base/conference/reducer.js
+++ b/react/features/base/conference/reducer.js
@@ -183,31 +183,34 @@ function _conferenceJoined(state, { conference }) {
* reduction of the specified action.
*/
function _conferenceLeft(state, { conference }) {
- let output = state;
+ let nextState = state;
if (state.authRequired === conference) {
- output = set(output, 'authRequired', undefined);
+ nextState = set(nextState, 'authRequired', undefined);
}
if (state.conference === conference) {
- output = assign(output, {
+ nextState = assign(nextState, {
conference: undefined,
joining: undefined,
- leaving: undefined
+ leaving: undefined,
+
+ // XXX Clear/unset locked & password here for a conference which has
+ // been LOCKED_LOCALLY.
+ locked: undefined,
+ password: undefined
});
}
if (state.passwordRequired === conference) {
- // Note that in case the conference was joined those fields have been
- // cleared already, so this step needs to be done only if the room
- // unlock operation has been canceled and that's why it's not done in
- // the 'state.conference' condition above.
- output = assign(output, {
+ nextState = assign(nextState, {
+ // XXX Clear/unset locked & password here for a conference which has
+ // been LOCKED_REMOTELY.
locked: undefined,
password: undefined,
passwordRequired: undefined
});
}
- return output;
+ return nextState;
}
/**