Fix: Prevent flash in dark mode

This commit is contained in:
Mousumi Pal
2024-10-08 23:00:11 +05:30
parent 5b01664d53
commit 8308bd0039
2 changed files with 7 additions and 4 deletions

View File

@@ -3,7 +3,6 @@ import Navigation from './Navigation';
import Conversation from './conversation/Conversation';
import About from './About';
import PageNotFound from './PageNotFound';
import { inject } from '@vercel/analytics';
import { useMediaQuery } from './hooks';
import { useState } from 'react';
import Setting from './settings';
@@ -11,7 +10,6 @@ import './locale/i18n';
import { Outlet } from 'react-router-dom';
import { SharedConversation } from './conversation/SharedConversation';
import { useDarkTheme } from './hooks';
inject();
function MainLayout() {
const { isMobile } = useMediaQuery();
@@ -34,7 +32,10 @@ function MainLayout() {
}
export default function App() {
useDarkTheme();
const [,,componentMounted] = useDarkTheme();
if(!componentMounted) {
return <div />
}
return (
<div className="h-full relative overflow-auto">
<Routes>