mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-13 06:36:49 -05:00
Address potential crashes
This commit is contained in:
@@ -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 <div className="top-leaderboard" />;
|
||||
}
|
||||
|
||||
return <RampUnit type="leaderboard_atf" cssClass="top-leaderboard" />;
|
||||
return (
|
||||
<ErrorBoundary fallback={null}>
|
||||
<RampUnit type="leaderboard_atf" cssClass="top-leaderboard" />
|
||||
</ErrorBoundary>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -113,6 +113,7 @@ export default class Ramp extends React.Component {
|
||||
|
||||
componentWillUnmount() {
|
||||
window.ramp.que.push(() => {
|
||||
if (!this.unitToAdd) return;
|
||||
cleanUp(this.unitToAdd.selectorId);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ export default class RampUnit extends React.Component {
|
||||
}
|
||||
componentWillUnmount() {
|
||||
window.ramp.que.push(() => {
|
||||
if (!this.unitToAdd) return;
|
||||
cleanUp(this.unitToAdd.selectorId);
|
||||
});
|
||||
}
|
||||
|
||||
11
app/root.tsx
11
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 (
|
||||
<Ramp
|
||||
publisherId={import.meta.env.VITE_PLAYWIRE_PUBLISHER_ID}
|
||||
id={import.meta.env.VITE_PLAYWIRE_WEBSITE_ID}
|
||||
/>
|
||||
<ClientErrorBoundary fallback={null}>
|
||||
<Ramp
|
||||
publisherId={import.meta.env.VITE_PLAYWIRE_PUBLISHER_ID}
|
||||
id={import.meta.env.VITE_PLAYWIRE_WEBSITE_ID}
|
||||
/>
|
||||
</ClientErrorBoundary>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user