mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-08 01:45:28 +00:00
Run prettier on all files.
This commit is contained in:
@@ -1,27 +1,28 @@
|
||||
import localForage from "localforage";
|
||||
import { Provider } from "react-redux";
|
||||
import { Children } from "../types/Preact";
|
||||
import { dispatch, State, store } from ".";
|
||||
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
|
||||
import { dispatch, State, store } from ".";
|
||||
import { Children } from "../types/Preact";
|
||||
|
||||
interface Props {
|
||||
children: Children;
|
||||
children: Children;
|
||||
}
|
||||
|
||||
export default function State(props: Props) {
|
||||
const [loaded, setLoaded] = useState(false);
|
||||
export default function StateLoader(props: Props) {
|
||||
const [loaded, setLoaded] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
localForage.getItem("state")
|
||||
.then(state => {
|
||||
if (state !== null) {
|
||||
dispatch({ type: "__INIT", state: state as State });
|
||||
}
|
||||
|
||||
setLoaded(true);
|
||||
});
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
localForage.getItem("state").then((state) => {
|
||||
if (state !== null) {
|
||||
dispatch({ type: "__INIT", state: state as State });
|
||||
}
|
||||
|
||||
if (!loaded) return null;
|
||||
return <Provider store={store}>{props.children}</Provider>;
|
||||
setLoaded(true);
|
||||
});
|
||||
}, []);
|
||||
|
||||
if (!loaded) return null;
|
||||
return <Provider store={store}>{props.children}</Provider>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user