From e68f7ab65142fb7996a1dc4e1a05118f561bc827 Mon Sep 17 00:00:00 2001 From: SethBurkart123 Date: Wed, 8 May 2024 22:09:13 +1000 Subject: [PATCH] add an error boundary to all UI --- package.json | 1 + src/interface/main.tsx | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/package.json b/package.json index b077a18d..643939a5 100644 --- a/package.json +++ b/package.json @@ -69,6 +69,7 @@ "react-best-gradient-color-picker": "3.0.5", "react-confetti-explosion": "^2.1.2", "react-dom": "^18.2.0", + "react-error-boundary": "^4.0.13", "react-router-dom": "^6.22.0", "react-shadow": "^20.4.0", "react-toastify": "^10.0.5", diff --git a/src/interface/main.tsx b/src/interface/main.tsx index a7414c91..4ad3a444 100644 --- a/src/interface/main.tsx +++ b/src/interface/main.tsx @@ -1,6 +1,8 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import { HashRouter, Routes, Route } from 'react-router-dom'; +import { ErrorBoundary } from "react-error-boundary"; + import './index.css'; import SettingsPage from './pages/SettingsPage.js'; import browser from 'webextension-polyfill'; @@ -40,6 +42,21 @@ const root = ReactDOM.createRoot(document.getElementById('ExtensionPopup')!); root.render( + +

An error occurred 😭😭😭

+

Try clicking this button and see if it helps...

+ + + }> } /> @@ -49,5 +66,6 @@ root.render( } /> +
, ); \ No newline at end of file