diff --git a/src/presentation/App.jsx b/src/presentation/App.jsx
index 2ee0d768..e5bf46ed 100644
--- a/src/presentation/App.jsx
+++ b/src/presentation/App.jsx
@@ -17,6 +17,7 @@ import { CompositeResourceKind } from './pages/CompositeResourceKind.jsx';
import { Search } from './pages/Search.jsx';
import { useAppContext } from './providers/AppProvider.jsx';
import { OnWatchResourcesProvider } from './providers/OnWatchResourcesProvider.jsx';
+import { ErrorBoundary } from './components/common/ErrorBoundary.jsx';
import { Box, Text, VStack, Icon, Button } from '@chakra-ui/react';
import { FiAlertCircle, FiRefreshCw } from 'react-icons/fi';
@@ -106,44 +107,46 @@ const PublicRoute = ({ children }) => {
function App() {
return (
-
-
-
-
- }
- />
-
-
-
-
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
- } />
-
-
-
-
- }
- />
-
+
+
+
+
+
+ }
+ />
+
+
+
+
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+
+
+
+
+ }
+ />
+
+
);
}
diff --git a/src/presentation/components/common/ErrorBoundary.jsx b/src/presentation/components/common/ErrorBoundary.jsx
new file mode 100644
index 00000000..cbeb0255
--- /dev/null
+++ b/src/presentation/components/common/ErrorBoundary.jsx
@@ -0,0 +1,46 @@
+import { Component } from 'react';
+import { Box, Text, VStack, Icon, Button } from '@chakra-ui/react';
+import { FiAlertCircle, FiRefreshCw } from 'react-icons/fi';
+
+export class ErrorBoundary extends Component {
+ constructor(props) {
+ super(props);
+ this.state = { hasError: false };
+ }
+
+ static getDerivedStateFromError() {
+ return { hasError: true };
+ }
+
+ componentDidCatch(error, errorInfo) {
+ console.error('Unhandled render error:', error, errorInfo);
+ }
+
+ render() {
+ if (this.state.hasError) {
+ return (
+
+
+
+
+ Something went wrong
+
+
+ An unexpected error occurred while rendering this page. Reloading the page usually resolves it.
+
+ }
+ colorScheme="blue"
+ onClick={() => window.location.reload()}
+ mt={2}
+ >
+ Reload Page
+
+
+
+ );
+ }
+
+ return this.props.children;
+ }
+}