mirror of
https://github.com/vector-im/element-call.git
synced 2026-04-06 07:20:25 +00:00
move sendContentLoaded (useTheme -> App)
Signed-off-by: Timo K <toger5@hotmail.de>
This commit is contained in:
@@ -72,7 +72,9 @@ export const App: FC<AppProps> = ({ history }) => {
|
||||
const [loaded, setLoaded] = useState(false);
|
||||
useEffect(() => {
|
||||
Initializer.init()?.then(() => {
|
||||
if (loaded) return;
|
||||
setLoaded(true);
|
||||
widget?.api.sendContentLoaded();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -17,11 +17,9 @@ limitations under the License.
|
||||
import { useLayoutEffect, useRef } from "react";
|
||||
|
||||
import { useUrlParams } from "./UrlParams";
|
||||
import { widget } from "./widget";
|
||||
|
||||
export const useTheme = (): void => {
|
||||
const { theme: themeName } = useUrlParams();
|
||||
const contentLoadedSent = useRef<boolean>(false);
|
||||
const previousTheme = useRef<string | null>(document.body.classList.item(0));
|
||||
useLayoutEffect(() => {
|
||||
// If the url does not contain a theme props we default to "dark".
|
||||
@@ -39,9 +37,5 @@ export const useTheme = (): void => {
|
||||
previousTheme.current = themeString;
|
||||
}
|
||||
document.body.classList.remove("nodisplay");
|
||||
if (!contentLoadedSent.current) {
|
||||
widget?.api.sendContentLoaded();
|
||||
contentLoadedSent.current = true;
|
||||
}
|
||||
}, [previousTheme, themeName]);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user