Skip to content

Commit

Permalink
Merge pull request #308 from Build-Squad/minor-fixes-prod
Browse files Browse the repository at this point in the history
Refactor layout component to include PersistGate for Redux state pers…
  • Loading branch information
muditmahajan authored Apr 8, 2024
2 parents f8b46e5 + 0c9012b commit add6fcd
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions src/ui/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import { Provider } from "react-redux";
import ThemeRegistry from "./ThemeRegistry";
import Navbar from "./components/navbar";
import "./globals.css";
import { PersistGate } from "redux-persist/es/integration/react";
import persistStore from "redux-persist/es/persistStore";
import { Backdrop, CircularProgress } from "@mui/material";

const inter = Inter({ subsets: ["latin"] });

Expand All @@ -23,6 +26,8 @@ export default function RootLayout({
storeRef.current = makeStore();
}

const persistor = persistStore(storeRef.current);

return (
<html lang="en">
<head>
Expand All @@ -38,14 +43,23 @@ export default function RootLayout({
}}
preventDuplicate
>
<Provider store={storeRef.current}>
<ThemeRegistry options={{ key: "mui-theme" }}>
<WalletContextProvider>
<Navbar />
{children}
</WalletContextProvider>
</ThemeRegistry>
</Provider>
<PersistGate
loading={
<Backdrop open={true}>
<CircularProgress color="secondary" />
</Backdrop>
}
persistor={persistor}
>
<Provider store={storeRef.current}>
<ThemeRegistry options={{ key: "mui-theme" }}>
<WalletContextProvider>
<Navbar />
{children}
</WalletContextProvider>
</ThemeRegistry>
</Provider>
</PersistGate>
</SnackbarProvider>
</body>
</html>
Expand Down

0 comments on commit add6fcd

Please sign in to comment.