From 2356a7195fc3decff60a7bdfb58954a32a056b8e Mon Sep 17 00:00:00 2001
From: Kalle <38327916+Sendouc@users.noreply.github.com>
Date: Tue, 15 Oct 2024 22:17:50 +0300
Subject: [PATCH] Address potential crashes
---
app/components/layout/index.tsx | 7 ++++++-
app/components/ramp/Ramp.tsx | 1 +
app/components/ramp/RampUnit.tsx | 1 +
app/root.tsx | 11 +++++++----
4 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/app/components/layout/index.tsx b/app/components/layout/index.tsx
index 88248476d..36e4e98ec 100644
--- a/app/components/layout/index.tsx
+++ b/app/components/layout/index.tsx
@@ -1,6 +1,7 @@
import { Link, useLocation, useMatches } from "@remix-run/react";
import clsx from "clsx";
import * as React from "react";
+import { ErrorBoundary } from "react-error-boundary";
import { useTranslation } from "react-i18next";
import { useIsMounted } from "~/hooks/useIsMounted";
import type { RootLoaderData } from "~/root";
@@ -155,5 +156,9 @@ function MyRampUnit() {
return
;
}
- return ;
+ return (
+
+
+
+ );
}
diff --git a/app/components/ramp/Ramp.tsx b/app/components/ramp/Ramp.tsx
index cc54d2592..842570fdc 100644
--- a/app/components/ramp/Ramp.tsx
+++ b/app/components/ramp/Ramp.tsx
@@ -113,6 +113,7 @@ export default class Ramp extends React.Component {
componentWillUnmount() {
window.ramp.que.push(() => {
+ if (!this.unitToAdd) return;
cleanUp(this.unitToAdd.selectorId);
});
}
diff --git a/app/components/ramp/RampUnit.tsx b/app/components/ramp/RampUnit.tsx
index fe0ca197b..cc48b5da7 100644
--- a/app/components/ramp/RampUnit.tsx
+++ b/app/components/ramp/RampUnit.tsx
@@ -78,6 +78,7 @@ export default class RampUnit extends React.Component {
}
componentWillUnmount() {
window.ramp.que.push(() => {
+ if (!this.unitToAdd) return;
cleanUp(this.unitToAdd.selectorId);
});
}
diff --git a/app/root.tsx b/app/root.tsx
index afd541d19..fa05e2dde 100644
--- a/app/root.tsx
+++ b/app/root.tsx
@@ -18,6 +18,7 @@ import {
import generalI18next from "i18next";
import NProgress from "nprogress";
import * as React from "react";
+import { ErrorBoundary as ClientErrorBoundary } from "react-error-boundary";
import { useTranslation } from "react-i18next";
import { useChangeLanguage } from "remix-i18next/react";
import type { SendouRouteHandle } from "~/utils/remix";
@@ -474,9 +475,11 @@ function MyRamp({ data }: { data: RootLoaderData | undefined }) {
}
return (
-
+
+
+
);
}