Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Memo the context

Manav Rathie5a43e9738c4
diff --git a/web/apps/auth/src/pages/_app.tsx b/web/apps/auth/src/pages/_app.tsx
index 98feccc295..8cd9f1cc33 100644
--- a/web/apps/auth/src/pages/_app.tsx
+++ b/web/apps/auth/src/pages/_app.tsx
@@ -27,7 +27,7 @@ import { ThemeProvider } from "@mui/material/styles";
import { t } from "i18next";
import type { AppProps } from "next/app";
import { useRouter } from "next/router";
-import React, { useCallback, useEffect, useState } from "react";
+import React, { useCallback, useEffect, useMemo, useState } from "react";
import { AppContext } from "types/context";
import "../../public/css/global.css";
@@ -81,19 +81,20 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {
};
}, []);
- const showNavBar = (show: boolean) => setShowNavBar(show);
-
const logout = useCallback(() => {
void accountLogout().then(() => window.location.replace("/"));
}, []);
- const appContext = {
- logout,
- showNavBar,
- showMiniDialog,
- themeColor,
- setThemeColor,
- };
+ const appContext = useMemo(
+ () => ({
+ logout,
+ showNavBar: (show: boolean) => setShowNavBar(show),
+ showMiniDialog,
+ themeColor,
+ setThemeColor,
+ }),
+ [logout, showMiniDialog, themeColor, setThemeColor],
+ );
const title = isI18nReady ? t("title_auth") : staticAppTitle;