fix(dynamic-branding) fix loading on web

The configuration is not stored in Redux by the time we try to fetch it,
so use the global on Window, which will.
This commit is contained in:
Saúl Ibarra Corretgé 2022-07-13 09:53:15 +02:00 committed by Saúl Ibarra Corretgé
parent eb20e85166
commit 989b8d9c2b
1 changed files with 5 additions and 1 deletions

View File

@ -36,7 +36,11 @@ export function extractFqnFromPath(state?: Object) {
*/
export async function getDynamicBrandingUrl(stateful: Object | Function) {
const state = toState(stateful);
const config = state['features/base/config'];
// NB: On web this is dispatched really early, before the config has been stored in the
// state. Thus, fetch it from the window global.
const config
= navigator.product === 'ReactNative' ? state['features/base/config'] : window.config;
const { dynamicBrandingUrl } = config;
if (dynamicBrandingUrl) {