From 0520c52e5d9651ceac4b5ffa8e6812fecbf54f7f Mon Sep 17 00:00:00 2001 From: jollygrin Date: Wed, 3 Apr 2024 01:29:08 +0200 Subject: [PATCH] remove error boundary - doesnt work with next export --- components/ErrorBoundary.tsx | 97 ------------------------------------ pages/_app.tsx | 53 ++++++++++---------- 2 files changed, 25 insertions(+), 125 deletions(-) delete mode 100644 components/ErrorBoundary.tsx diff --git a/components/ErrorBoundary.tsx b/components/ErrorBoundary.tsx deleted file mode 100644 index 7a8823b..0000000 --- a/components/ErrorBoundary.tsx +++ /dev/null @@ -1,97 +0,0 @@ -import React from "react"; - -interface ErrorBoundaryProps { - children: React.ReactNode; -} - -class ErrorBoundary extends React.Component { - constructor(props: ErrorBoundaryProps) { - super(props); - - // Define a state variable to track whether is an error or not - this.state = { hasError: false }; - } - - static getDerivedStateFromError(error: Error): { hasError: boolean } { - // Update state so the next render will show the fallback UI - return { hasError: true }; - } - - componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void { - // You can use your own error logging service here - console.log({ error, errorInfo }); - } - - render(): React.ReactNode { - // Check if the error is thrown - - //@ts-ignore - if (this?.state?.hasError) { - // You can render any custom fallback UI - return ( -
-

Oops, there is an error!

-

It's likely an issue with a corrupted deck/map/json.

- -
- - -
-

- If this doesn't fix: Right click > Inspect > Console to - view the error.{" "} -

-

- Copy/paste the console error and below data to the unbrewed discord - or github for help. -

- -
-

Deck Local Storage

- - {localStorage.getItem("DECKS")} - -

Map Local Storage

- - {localStorage.getItem("MAP_LIST")} - -
- ); - } - - // Return children components in case of no error - return this.props.children; - } -} - -export default ErrorBoundary; diff --git a/pages/_app.tsx b/pages/_app.tsx index ba00e4f..0886049 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -12,40 +12,37 @@ import { } from "@tanstack/react-query"; import "@/styles/fonts.css"; import { Toaster } from "react-hot-toast"; -import ErrorBoundary from "@/components/ErrorBoundary"; export default function App({ Component, pageProps }: AppProps) { const [queryClient] = useState(() => new QueryClient()); return ( <> - - - - - - - {/* @ts-ignore */} - - - - - + + + + + + {/* @ts-ignore */} + + + + ); }