diff --git a/src/useTheme.ts b/src/useTheme.ts index 5cc9021d..18f1e741 100644 --- a/src/useTheme.ts +++ b/src/useTheme.ts @@ -21,6 +21,7 @@ import { widget } from "./widget"; export const useTheme = (): void => { const { theme: themeName } = useUrlParams(); + const contentLoadedSent = useRef(false); const previousTheme = useRef(document.body.classList.item(0)); useLayoutEffect(() => { // If the url does not contain a theme props we default to "dark". @@ -38,5 +39,9 @@ export const useTheme = (): void => { previousTheme.current = themeString; } document.body.classList.remove("nodisplay"); + if (!contentLoadedSent.current) { + widget?.api.sendContentLoaded(); + contentLoadedSent.current = true; + } }, [previousTheme, themeName]); }; diff --git a/src/widget.ts b/src/widget.ts index 1ca6a2e3..32ab780e 100644 --- a/src/widget.ts +++ b/src/widget.ts @@ -158,6 +158,8 @@ export const widget = ((): WidgetHelpers | null => { useE2eForGroupCall: e2eEnabled, fallbackICEServerAllowed: allowIceFallback, }, + // ContentLoaded event will be sent as soon as the theme is set (see useTheme.ts) + false, ); const clientPromise = new Promise((resolve) => {