Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(base/config): reuse config.js when the preload script already fetched it

Hristo Terezov893fb5293e0d
diff --git a/react/features/base/lib-jitsi-meet/functions.web.ts b/react/features/base/lib-jitsi-meet/functions.web.ts
index c00a690e28..f630de8165 100644
--- a/react/features/base/lib-jitsi-meet/functions.web.ts
+++ b/react/features/base/lib-jitsi-meet/functions.web.ts
@@ -1,3 +1,4 @@
+import { takePreloadedConfig } from '../../preload/functions';
import { IConfig } from '../config/configType';
import { parseConfigInWorker } from '../config/parseConfigInWorker';
@@ -12,6 +13,19 @@ export * from './functions.any';
* @returns {Promise<IConfig>}
*/
export async function loadConfig(url: string): Promise<IConfig> {
+ const preloaded = takePreloadedConfig(url);
+
+ if (preloaded) {
+ try {
+ const config = await preloaded;
+
+ logger.info(`Config loaded from ${url} (preloaded)`);
+
+ return config;
+ } catch (err) {
+ logger.warn(`Preloaded config from ${url} failed, loading it again`, err);
+ }
+ }
try {
const response = await fetch(url);