diff --git a/web/apps/accounts/src/pages/_app.tsx b/web/apps/accounts/src/pages/_app.tsx index 2aed14e48..40a4a1458 100644 --- a/web/apps/accounts/src/pages/_app.tsx +++ b/web/apps/accounts/src/pages/_app.tsx @@ -1,5 +1,6 @@ import { CustomHead } from "@/next/components/Head"; import { setupI18n } from "@/next/i18n"; +import { logUnhandledErrorsAndRejections } from "@/next/log-web"; import { APPS, APP_TITLES } from "@ente/shared/apps/constants"; import { Overlay } from "@ente/shared/components/Container"; import DialogBoxV2 from "@ente/shared/components/DialogBoxV2"; @@ -54,6 +55,8 @@ export default function App({ Component, pageProps }: AppProps) { useEffect(() => { setupI18n().finally(() => setIsI18nReady(true)); + logUnhandledErrorsAndRejections(true); + return () => logUnhandledErrorsAndRejections(false); }, []); const setupPackageName = () => { diff --git a/web/apps/auth/src/pages/_app.tsx b/web/apps/auth/src/pages/_app.tsx index bd59ac225..bf1093c90 100644 --- a/web/apps/auth/src/pages/_app.tsx +++ b/web/apps/auth/src/pages/_app.tsx @@ -1,6 +1,9 @@ import { CustomHead } from "@/next/components/Head"; import { setupI18n } from "@/next/i18n"; -import { logStartupBanner } from "@/next/log-web"; +import { + logStartupBanner, + logUnhandledErrorsAndRejections, +} from "@/next/log-web"; import { APPS, APP_TITLES, @@ -68,9 +71,11 @@ export default function App({ Component, pageProps }: AppProps) { setupI18n().finally(() => setIsI18nReady(true)); const userId = (getData(LS_KEYS.USER) as User)?.id; logStartupBanner(APPS.AUTH, userId); + logUnhandledErrorsAndRejections(true); HTTPService.setHeaders({ "X-Client-Package": CLIENT_PACKAGE_NAMES.get(APPS.AUTH), }); + return () => logUnhandledErrorsAndRejections(false); }, []); const setUserOnline = () => setOffline(false); diff --git a/web/apps/cast/src/pages/_app.tsx b/web/apps/cast/src/pages/_app.tsx index 3f22f687c..99b047d41 100644 --- a/web/apps/cast/src/pages/_app.tsx +++ b/web/apps/cast/src/pages/_app.tsx @@ -1,12 +1,20 @@ import { CustomHead } from "@/next/components/Head"; +import { logUnhandledErrorsAndRejections } from "@/next/log-web"; import { APPS, APP_TITLES } from "@ente/shared/apps/constants"; import { getTheme } from "@ente/shared/themes"; import { THEME_COLOR } from "@ente/shared/themes/constants"; import { CssBaseline, ThemeProvider } from "@mui/material"; import type { AppProps } from "next/app"; +import { useEffect } from "react"; + import "styles/global.css"; export default function App({ Component, pageProps }: AppProps) { + useEffect(() => { + logUnhandledErrorsAndRejections(true); + return () => logUnhandledErrorsAndRejections(false); + }, []); + return ( <> diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsx index 0b5758609..06961d6c9 100644 --- a/web/apps/photos/src/pages/_app.tsx +++ b/web/apps/photos/src/pages/_app.tsx @@ -154,9 +154,7 @@ export default function App({ Component, pageProps }: AppProps) { HTTPService.setHeaders({ "X-Client-Package": CLIENT_PACKAGE_NAMES.get(APPS.PHOTOS), }); - return () => { - logUnhandledErrorsAndRejections(false); - }; + return () => logUnhandledErrorsAndRejections(false); }, []); useEffect(() => {