Skip to content

Commit 6e3d326

Browse files
authored
Merge pull request meshtastic#458 from danditomaso/feat/add-error-boundary
feat: add error boundary
2 parents cbcbafc + b888d8f commit 6e3d326

File tree

21 files changed

+281
-97
lines changed

21 files changed

+281
-97
lines changed

bun.lock

+5
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"maplibre-gl": "5.1.1",
3838
"react": "^19.0.0",
3939
"react-dom": "^19.0.0",
40+
"react-error-boundary": "^5.0.0",
4041
"react-hook-form": "^7.54.2",
4142
"react-map-gl": "8.0.1",
4243
"react-qrcode-logo": "^3.0.0",
@@ -1523,6 +1524,8 @@
15231524

15241525
"react-dom": ["[email protected]", "", { "dependencies": { "scheduler": "^0.25.0" }, "peerDependencies": { "react": "^19.0.0" } }, "sha512-4GV5sHFG0e/0AD4X+ySy6UJd3jVl1iNsNHdpad0qhABJ11twS3TTBnseqsKurKcsNqCEFeGL3uLpVChpIO3QfQ=="],
15251526

1527+
"react-error-boundary": ["[email protected]", "", { "dependencies": { "@babel/runtime": "^7.12.5" }, "peerDependencies": { "react": ">=16.13.1" } }, "sha512-tnjAxG+IkpLephNcePNA7v6F/QpWLH8He65+DmedchDwg162JZqx4NmbXj0mlAYVVEd81OW7aFhmbsScYfiAFQ=="],
1528+
15261529
"react-hook-form": ["[email protected]", "", { "peerDependencies": { "react": "^16.8.0 || ^17 || ^18 || ^19" } }, "sha512-eHpAUgUjWbZocoQYUHposymRb4ZP6d0uwUnooL2uOybA9/3tPUvoAKqEWK1WaSiTxxOfTpffNZP7QwlnM3/gEg=="],
15271530

15281531
"react-is": ["[email protected]", "", {}, "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w=="],
@@ -1543,6 +1546,8 @@
15431546

15441547
"readable-stream": ["[email protected]", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="],
15451548

1549+
"regenerator-runtime": ["[email protected]", "", {}, "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw=="],
1550+
15461551
"reflect.getprototypeof": ["[email protected]", "", { "dependencies": { "call-bind": "^1.0.8", "define-properties": "^1.2.1", "es-abstract": "^1.23.9", "es-errors": "^1.3.0", "es-object-atoms": "^1.0.0", "get-intrinsic": "^1.2.7", "get-proto": "^1.0.1", "which-builtin-type": "^1.2.1" } }, "sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw=="],
15471552

15481553
"regenerate": ["[email protected]", "", {}, "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A=="],

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
"maplibre-gl": "5.1.1",
7171
"react": "^19.0.0",
7272
"react-dom": "^19.0.0",
73+
"react-error-boundary": "^5.0.0",
7374
"react-hook-form": "^7.54.2",
7475
"react-map-gl": "8.0.1",
7576
"react-qrcode-logo": "^3.0.0",

public/images/chirpy.svg

+1
Loading

src/App.tsx

+26-23
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ import { useAppStore } from "@core/stores/appStore.ts";
1212
import { useDeviceStore } from "@core/stores/deviceStore.ts";
1313
import { Dashboard } from "@pages/Dashboard/index.tsx";
1414
import type { JSX } from "react";
15+
import { ErrorBoundary } from "react-error-boundary";
16+
import { ErrorPage } from "./components/UI/ErrorPage";
1517
import { MapProvider } from "react-map-gl/maplibre";
1618

19+
1720
export const App = (): JSX.Element => {
1821
const { getDevice } = useDeviceStore();
1922
const { selectedDevice, setConnectDialogOpen, connectDialogOpen } =
@@ -22,38 +25,38 @@ export const App = (): JSX.Element => {
2225
const device = getDevice(selectedDevice);
2326

2427
return (
25-
<>
28+
<ErrorBoundary FallbackComponent={ErrorPage}>
2629
<NewDeviceDialog
2730
open={connectDialogOpen}
2831
onOpenChange={(open) => {
2932
setConnectDialogOpen(open);
3033
}}
3134
/>
3235
<Toaster />
33-
<MapProvider>
34-
<DeviceWrapper device={device}>
35-
<div className="flex h-screen flex-col overflow-hidden bg-background-primary text-text-primary">
36-
<div className="flex grow">
37-
<DeviceSelector />
38-
<div className="flex grow flex-col">
39-
{device ? (
40-
<div className="flex h-screen">
41-
<DialogManager />
42-
<KeyBackupReminder />
43-
<CommandPalette />
36+
<DeviceWrapper device={device}>
37+
<div className="flex h-screen flex-col overflow-hidden bg-background-primary text-text-primary">
38+
<div className="flex grow">
39+
<DeviceSelector />
40+
<div className="flex grow flex-col">
41+
{device ? (
42+
<div className="flex h-screen w-full">
43+
<DialogManager />
44+
<KeyBackupReminder />
45+
<CommandPalette />
46+
<MapProvider>
4447
<PageRouter />
45-
</div>
46-
) : (
47-
<>
48-
<Dashboard />
49-
<Footer />
50-
</>
51-
)}
52-
</div>
48+
</MapProvider>
49+
</div>
50+
) : (
51+
<>
52+
<Dashboard />
53+
<Footer />
54+
</>
55+
)}
5356
</div>
5457
</div>
55-
</DeviceWrapper>
56-
</MapProvider>
57-
</>
58+
</div>
59+
</DeviceWrapper>
60+
</ErrorBoundary>
5861
);
5962
};

0 commit comments

Comments
 (0)