From 1b45b0917fd986b18bf6a334f44d78c177b169c1 Mon Sep 17 00:00:00 2001 From: Aarnav Tale Date: Fri, 17 Jan 2025 11:45:36 +0000 Subject: [PATCH] fix: handle headscale unavailability gracefully --- app/components/Error.tsx | 5 +- app/components/Footer.tsx | 2 +- app/components/Header.tsx | 12 ++-- app/layouts/dashboard.tsx | 98 ++++++++++++++++---------------- app/layouts/shell.tsx | 33 +++++++++++ app/root.tsx | 25 +++++++- app/routes.ts | 26 +++++---- app/routes/auth/login.tsx | 7 +-- app/routes/machines/overview.tsx | 7 +++ 9 files changed, 135 insertions(+), 80 deletions(-) create mode 100644 app/layouts/shell.tsx diff --git a/app/components/Error.tsx b/app/components/Error.tsx index 98756b9..e52b3c4 100644 --- a/app/components/Error.tsx +++ b/app/components/Error.tsx @@ -8,7 +8,6 @@ interface Props { type?: 'full' | 'embedded'; } - function getMessage(error: Error | unknown) { if (!(error instanceof Error)) { return "An unknown error occurred"; @@ -18,9 +17,9 @@ function getMessage(error: Error | unknown) { // Traverse the error chain to find the root cause if (error.cause) { - rootError = error.cause; + rootError = error.cause as Error; while (rootError.cause) { - rootError = rootError.cause; + rootError = rootError.cause as Error; } } diff --git a/app/components/Footer.tsx b/app/components/Footer.tsx index 9f4d118..703f221 100644 --- a/app/components/Footer.tsx +++ b/app/components/Footer.tsx @@ -15,7 +15,7 @@ export default function Footer({ url, debug }: FooterProps) { return (