-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(website): handle styles not appearing in root component
This workaround for this bug remix-run/remix#1136.
- Loading branch information
Showing
15 changed files
with
71 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
declare module "routes-gen" { | ||
export type RouteParams = { | ||
"/": Record<string, never>; | ||
"/questions/create-or-update": Record<string, never>; | ||
"/information/toolchain": Record<string, never>; | ||
"/questions/solve/:slug": { "slug": string }; | ||
"/playground": Record<string, never>; | ||
"/classes/create": Record<string, never>; | ||
"/questions/list": Record<string, never>; | ||
"/auth/logout": Record<string, never>; | ||
"/classes/:id": { "id": string }; | ||
"/": Record<string, never>; | ||
"/auth": Record<string, never>; | ||
"/auth/logout": Record<string, never>; | ||
}; | ||
|
||
export function route< | ||
T extends | ||
| ["/"] | ||
| ["/questions/create-or-update"] | ||
| ["/information/toolchain"] | ||
| ["/questions/solve/:slug", RouteParams["/questions/solve/:slug"]] | ||
| ["/playground"] | ||
| ["/classes/create"] | ||
| ["/questions/list"] | ||
| ["/auth/logout"] | ||
| ["/classes/:id", RouteParams["/classes/:id"]] | ||
| ["/"] | ||
| ["/auth"] | ||
| ["/auth/logout"] | ||
>(...args: T): typeof args[0]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { Outlet, useCatch } from '@remix-run/react'; | ||
import { ErrorPage } from '~/lib/components/ErrorPage'; | ||
import type { CatchBoundaryComponent } from '@remix-run/react/dist/routeModules'; | ||
import type { ErrorBoundaryComponent } from '@remix-run/server-runtime'; | ||
|
||
// We have to use this workaround because of a bug in Remix | ||
// https://github.com/remix-run/remix/issues/1136. Solution taken from | ||
// https://github.com/remix-run/remix/issues/1136#issuecomment-1314519567 | ||
|
||
export default () => { | ||
return <Outlet />; | ||
}; | ||
|
||
export const ErrorBoundary: ErrorBoundaryComponent = ({ error }) => { | ||
return ( | ||
<ErrorPage | ||
statusCode={500} | ||
message={'Internal Server Error'} | ||
description={ | ||
"Our servers could not handle your request. Don't worry, our development team was already notified." | ||
} | ||
stack={error.stack} | ||
/> | ||
); | ||
}; | ||
|
||
export const CatchBoundary: CatchBoundaryComponent = () => { | ||
const caught = useCatch(); | ||
|
||
return ( | ||
<ErrorPage | ||
statusCode={caught?.status} | ||
message={caught?.data?.message || 'Not Found'} | ||
description={ | ||
caught?.data?.description || | ||
'We could not find what you were looking for. If you think it should be here, please contact us.' | ||
} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { useCatch } from '@remix-run/react'; | ||
import { ErrorPage } from '~/lib/components/ErrorPage'; | ||
|
||
// needed to tell remix that this isn't a resource route | ||
export default function CatchAllPage() { | ||
const caught = useCatch(); | ||
|
||
return ( | ||
<ErrorPage | ||
statusCode={caught?.status || 404} | ||
message={caught?.data?.message || 'Not Found'} | ||
description={ | ||
caught?.data?.description || | ||
'We could not find what you were looking for. If you think it should be here, please contact us.' | ||
} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
apps/website/app/routes/auth/logout.tsx → ...ite/app/routes/__boundary/auth/logout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
10 changes: 5 additions & 5 deletions
10
apps/website/app/routes/classes/create.tsx → .../app/routes/__boundary/classes/create.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.