Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release <- Main #314

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions src/ui/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import { Inter } from "next/font/google";
import { SnackbarProvider } from "notistack";
import { useRef } from "react";
import { Provider } from "react-redux";
import { PersistGate } from "redux-persist/es/integration/react";
import persistStore from "redux-persist/es/persistStore";
import { Persistor } from "redux-persist/es/types";
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 @@ -21,12 +21,16 @@ export default function RootLayout({
children: React.ReactNode;
}) {
const storeRef = useRef<AppStore>();
const persistorRef = useRef<Persistor>();
if (!storeRef.current) {
// Create the store instance the first time this renders
storeRef.current = makeStore();
}

const persistor = persistStore(storeRef.current);
if (!persistorRef.current) {
// Create the persistor instance the first time this renders
persistorRef.current = persistStore(storeRef.current);
}

return (
<html lang="en">
Expand All @@ -44,14 +48,7 @@ export default function RootLayout({
preventDuplicate
>
<Provider store={storeRef.current}>
<PersistGate
loading={
<Backdrop open={true}>
<CircularProgress color="secondary" />
</Backdrop>
}
persistor={persistor}
>
<PersistGate loading={null} persistor={persistorRef.current}>
<ThemeRegistry options={{ key: "mui-theme" }}>
<WalletContextProvider>
<Navbar />
Expand Down
Loading