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 processing outdated loadConfig requests

Saúl Ibarra Corretgé357b2068318f
diff --git a/react/features/app/actions.js b/react/features/app/actions.js
index 26193be1e6..cccbfa56da 100644
--- a/react/features/app/actions.js
+++ b/react/features/app/actions.js
@@ -1,5 +1,7 @@
/* @flow */
+import type { Dispatch } from 'redux';
+
import { setRoom } from '../base/conference';
import {
configWillLoad,
@@ -71,9 +73,17 @@ function _appNavigateToMandatoryLocation(
* @returns {void}
*/
function loadConfigSettled(error, config) {
- // FIXME Due to the asynchronous nature of the loading, the specified
+ // Due to the asynchronous nature of the loading, the specified
// config may or may not be required by the time the notification
- // arrives.
+ // arrives. If we receive the config for a location we are no longer
+ // interested in, just dump it.
+
+ const { locationURL: currentLocationURL }
+ = getState()['features/base/config'];
+
+ if (currentLocationURL !== newLocation) {
+ throw new Error('Config no longer needed');
+ }
const promise
= dispatch(setLocationURL(new URL(newLocation.toString())));
diff --git a/react/features/base/config/reducer.js b/react/features/base/config/reducer.js
index eceb94247d..5c7b203afe 100644
--- a/react/features/base/config/reducer.js
+++ b/react/features/base/config/reducer.js
@@ -53,7 +53,8 @@ ReducerRegistry.register(
switch (action.type) {
case CONFIG_WILL_LOAD:
return {
- error: undefined
+ error: undefined,
+ locationURL: action.locationURL
};
case LOAD_CONFIG_ERROR: