You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.0 KiB
TypeScript
46 lines
1.0 KiB
TypeScript
5 years ago
|
// SPDX-FileCopyrightText: © 2017 EteSync Authors
|
||
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||
|
|
||
4 years ago
|
import * as React from "react";
|
||
|
import * as ReactDOM from "react-dom";
|
||
|
import { Provider } from "react-redux";
|
||
|
import { PersistGate } from "redux-persist/es/integration/react";
|
||
|
import App from "./App";
|
||
|
import registerServiceWorker from "./registerServiceWorker";
|
||
|
import "./index.css";
|
||
7 years ago
|
|
||
4 years ago
|
import * as Etebase from "etebase";
|
||
|
|
||
|
function MyPersistGate(props: React.PropsWithChildren<{}>) {
|
||
|
const [loading, setLoading] = React.useState(true);
|
||
|
|
||
|
React.useEffect(() => {
|
||
|
Etebase.ready.then(() => {
|
||
|
setLoading(false);
|
||
|
persistor.persist();
|
||
|
});
|
||
|
}, []);
|
||
|
|
||
|
if (loading) {
|
||
|
return (<React.Fragment />);
|
||
|
}
|
||
|
|
||
|
return (
|
||
|
<PersistGate persistor={persistor}>
|
||
|
{props.children}
|
||
|
</PersistGate>
|
||
|
);
|
||
|
}
|
||
|
|
||
4 years ago
|
import { store, persistor } from "./store";
|
||
7 years ago
|
|
||
7 years ago
|
ReactDOM.render(
|
||
7 years ago
|
<Provider store={store}>
|
||
4 years ago
|
<MyPersistGate>
|
||
7 years ago
|
<App />
|
||
4 years ago
|
</MyPersistGate>
|
||
7 years ago
|
</Provider>,
|
||
4 years ago
|
document.getElementById("root") as HTMLElement
|
||
7 years ago
|
);
|
||
|
registerServiceWorker();
|