[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.
pull/1476/head jitsi-meet_1969
Saúl Ibarra Corretgé 8 years ago committed by Lyubo Marinov
parent 18a81d7ca0
commit a1da6bff1a
  1. 12
      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(dispatch(initLib()));
disposeLibPromise.then(() => {
// Let the new config into the Redux store (because initLib will read it
// from there).
next(action);
return nextState;
dispatch(initLib());
});
}

Loading…
Cancel
Save