Skip to content

Commit

Permalink
Address potential crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sendouc committed Oct 15, 2024
1 parent da972c1 commit 2356a71
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
7 changes: 6 additions & 1 deletion app/components/layout/index.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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>
);
}
1 change: 1 addition & 0 deletions app/components/ramp/Ramp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export default class Ramp extends React.Component {

componentWillUnmount() {
window.ramp.que.push(() => {
if (!this.unitToAdd) return;
cleanUp(this.unitToAdd.selectorId);
});
}
Expand Down
1 change: 1 addition & 0 deletions app/components/ramp/RampUnit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export default class RampUnit extends React.Component {
}
componentWillUnmount() {
window.ramp.que.push(() => {
if (!this.unitToAdd) return;
cleanUp(this.unitToAdd.selectorId);
});
}
Expand Down
11 changes: 7 additions & 4 deletions app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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>
);
}

0 comments on commit 2356a71

Please sign in to comment.