Lame fix for Flash of Welcome Page (FoWP)

useEffect runs after mounted so Welcome component appears for a split second
This commit is contained in:
Lim Chee Aun 2022-12-21 20:34:24 +08:00
parent eba78e3f07
commit c828f53f09

View file

@ -104,7 +104,7 @@ async function startStream() {
export function App() {
const snapStates = useSnapshot(states);
const [isLoggedIn, setIsLoggedIn] = useState(false);
const [uiState, setUIState] = useState('default');
const [uiState, setUIState] = useState('loading');
useLayoutEffect(() => {
const theme = store.local.get('theme');
@ -194,6 +194,8 @@ export function App() {
}
setUIState('default');
})();
} else {
setUIState('default');
}
}, []);