[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.
This commit is contained in:
Saúl Ibarra Corretgé 2017-04-07 14:32:12 +02:00 committed by Lyubo Marinov
parent 18a81d7ca0
commit a1da6bff1a
1 changed files with 6 additions and 6 deletions

View File

@ -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());
});
}