From a1da6bff1a9669b43bc25661397fcf107db99122 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Fri, 7 Apr 2017 14:32:12 +0200 Subject: [PATCH] [RN] Fix loading config from non-default domains When a conference is to happen in a domain which is not the defaut, its config is loaded and set. As part of this process, lib-jitsi-meet is disposed. Because disposing is asynchronous, events happen in this sequence: - set new config - dispose lib (which effectively wipes the config) - init lib This results in the library to be initialized without the loaded config, which was lost. This commit fixes that by delaying setting the config and re-initializing the library until it was disposed. --- react/features/base/lib-jitsi-meet/middleware.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/react/features/base/lib-jitsi-meet/middleware.js b/react/features/base/lib-jitsi-meet/middleware.js index 2f0401078..7acee29e3 100644 --- a/react/features/base/lib-jitsi-meet/middleware.js +++ b/react/features/base/lib-jitsi-meet/middleware.js @@ -99,11 +99,11 @@ function _setConfig(store, next, action) { const disposeLibPromise = initialized ? dispatch(disposeLib()) : Promise.resolve(); - // Let the new config into the Redux store (because initLib will read it - // from there). - const nextState = next(action); + disposeLibPromise.then(() => { + // Let the new config into the Redux store (because initLib will read it + // from there). + next(action); - disposeLibPromise.then(dispatch(initLib())); - - return nextState; + dispatch(initLib()); + }); }