From 3bb09a64a3ecd41009c01aaf4c9ac7c45c5d79e3 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sat, 16 Jul 2022 13:21:01 +0300 Subject: [PATCH] Fix 404 page crashing --- app/components/Catcher.tsx | 25 +++++++++++++++++-------- app/components/layout/Footer.tsx | 14 ++++++++------ app/components/layout/index.tsx | 5 ++++- app/root.tsx | 29 ++++++++++++++++++++--------- cypress/e2e/misc.cy.ts | 8 ++++++++ 5 files changed, 57 insertions(+), 24 deletions(-) create mode 100644 cypress/e2e/misc.cy.ts diff --git a/app/components/Catcher.tsx b/app/components/Catcher.tsx index 0f4cb7b3e..8eb6aedd2 100644 --- a/app/components/Catcher.tsx +++ b/app/components/Catcher.tsx @@ -27,15 +27,24 @@ export function Catcher() { )} ); + case 404: + return ( + + Error {caught.status} - Page not found + + + ); + default: + return ( + + Error {caught.status} + {caught.data ? ( + {JSON.stringify(caught.data, null, 2)} + ) : null} + + + ); } - - return ( - - Error {caught.status} - {caught.data ? {JSON.stringify(caught.data, null, 2)} : null} - - - ); } function GetHelp() { diff --git a/app/components/layout/Footer.tsx b/app/components/layout/Footer.tsx index a33acc8f3..17e7d1697 100644 --- a/app/components/layout/Footer.tsx +++ b/app/components/layout/Footer.tsx @@ -1,4 +1,4 @@ -import { Link, useLoaderData } from "@remix-run/react"; +import { Link } from "@remix-run/react"; import type { RootLoaderData } from "~/root"; import { discordFullName } from "~/utils/strings"; import { @@ -16,9 +16,11 @@ import { PatreonIcon } from "../icons/Patreon"; import { TwitterIcon } from "../icons/Twitter"; import { Image } from "../Image"; -export function Footer() { - const data = useLoaderData(); - +export function Footer({ + patrons = [], +}: { + patrons?: RootLoaderData["patrons"]; +}) { return (
{JSON.stringify(caught.data, null, 2)}