-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7daaac7
commit ce81f69
Showing
8 changed files
with
1,235 additions
and
136 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 |
---|---|---|
|
@@ -7,3 +7,9 @@ node_modules | |
.wrangler | ||
|
||
.dev.vars | ||
|
||
# Sentry Config File | ||
.sentryclirc | ||
|
||
# Sentry Config File | ||
.env.sentry-build-plugin |
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,18 +1,32 @@ | ||
/** | ||
* By default, Remix will handle hydrating your app on the client for you. | ||
* You are free to delete this file if you'd like to, but if you ever want it revealed again, you can run `npx remix reveal` ✨ | ||
* For more information, see https://remix.run/file-conventions/entry.client | ||
*/ | ||
|
||
import { RemixBrowser } from "@remix-run/react"; | ||
import { startTransition, StrictMode } from "react"; | ||
import { hydrateRoot } from "react-dom/client"; | ||
|
||
startTransition(() => { | ||
hydrateRoot( | ||
document, | ||
<StrictMode> | ||
<RemixBrowser /> | ||
</StrictMode>, | ||
); | ||
}); | ||
import * as Sentry from "@sentry/remix"; | ||
/** | ||
* By default, Remix will handle hydrating your app on the client for you. | ||
* You are free to delete this file if you'd like to, but if you ever want it revealed again, you can run `npx remix reveal` ✨ | ||
* For more information, see https://remix.run/file-conventions/entry.client | ||
*/ | ||
|
||
import { RemixBrowser, useLocation, useMatches } from "@remix-run/react"; | ||
import { startTransition, StrictMode, useEffect } from "react"; | ||
import { hydrateRoot } from "react-dom/client"; | ||
|
||
Sentry.init({ | ||
dsn: "https://5f711f23dca8cae55c3ef1c0dde80b4e@o4507639875239936.ingest.us.sentry.io/4507639877992448", | ||
tracesSampleRate: 1, | ||
replaysSessionSampleRate: 0.1, | ||
replaysOnErrorSampleRate: 1, | ||
|
||
integrations: [Sentry.browserTracingIntegration({ | ||
useEffect, | ||
useLocation, | ||
useMatches | ||
}), Sentry.replayIntegration()] | ||
}) | ||
|
||
startTransition(() => { | ||
hydrateRoot( | ||
document, | ||
<StrictMode> | ||
<RemixBrowser /> | ||
</StrictMode>, | ||
); | ||
}); |
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,43 +1,48 @@ | ||
/** | ||
* By default, Remix will handle generating the HTTP Response for you. | ||
* You are free to delete this file if you'd like to, but if you ever want it revealed again, you can run `npx remix reveal` ✨ | ||
* For more information, see https://remix.run/file-conventions/entry.server | ||
*/ | ||
|
||
import type { AppLoadContext, EntryContext } from "@remix-run/cloudflare"; | ||
import { RemixServer } from "@remix-run/react"; | ||
import { isbot } from "isbot"; | ||
import { renderToReadableStream } from "react-dom/server"; | ||
|
||
export default async function handleRequest( | ||
request: Request, | ||
responseStatusCode: number, | ||
responseHeaders: Headers, | ||
remixContext: EntryContext, | ||
// This is ignored so we can keep it in the template for visibility. Feel | ||
// free to delete this parameter in your app if you're not using it! | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
loadContext: AppLoadContext, | ||
) { | ||
const body = await renderToReadableStream( | ||
<RemixServer context={remixContext} url={request.url} />, | ||
{ | ||
signal: request.signal, | ||
onError(error: unknown) { | ||
// Log streaming rendering errors from inside the shell | ||
console.error(error); | ||
responseStatusCode = 500; | ||
}, | ||
}, | ||
); | ||
|
||
if (isbot(request.headers.get("user-agent") || "")) { | ||
await body.allReady; | ||
} | ||
|
||
responseHeaders.set("Content-Type", "text/html"); | ||
return new Response(body, { | ||
headers: responseHeaders, | ||
status: responseStatusCode, | ||
}); | ||
} | ||
import * as Sentry from "@sentry/remix"; | ||
/** | ||
* By default, Remix will handle generating the HTTP Response for you. | ||
* You are free to delete this file if you'd like to, but if you ever want it revealed again, you can run `npx remix reveal` ✨ | ||
* For more information, see https://remix.run/file-conventions/entry.server | ||
*/ | ||
|
||
import type { AppLoadContext, EntryContext } from "@remix-run/cloudflare"; | ||
import { RemixServer } from "@remix-run/react"; | ||
import { isbot } from "isbot"; | ||
import { renderToReadableStream } from "react-dom/server"; | ||
|
||
export const handleError = Sentry.wrapHandleErrorWithSentry((error, { request }) => { | ||
// Custom handleError implementation | ||
}); | ||
|
||
export default async function handleRequest( | ||
request: Request, | ||
responseStatusCode: number, | ||
responseHeaders: Headers, | ||
remixContext: EntryContext, | ||
// This is ignored so we can keep it in the template for visibility. Feel | ||
// free to delete this parameter in your app if you're not using it! | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
loadContext: AppLoadContext, | ||
) { | ||
const body = await renderToReadableStream( | ||
<RemixServer context={remixContext} url={request.url} />, | ||
{ | ||
signal: request.signal, | ||
onError(error: unknown) { | ||
// Log streaming rendering errors from inside the shell | ||
console.error(error); | ||
responseStatusCode = 500; | ||
}, | ||
}, | ||
); | ||
|
||
if (isbot(request.headers.get("user-agent") || "")) { | ||
await body.allReady; | ||
} | ||
|
||
responseHeaders.set("Content-Type", "text/html"); | ||
return new Response(body, { | ||
headers: responseHeaders, | ||
status: responseStatusCode, | ||
}); | ||
} |
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,49 +1,50 @@ | ||
import { LinksFunction } from "@remix-run/cloudflare"; | ||
import { | ||
Links, | ||
Meta, | ||
Outlet, | ||
Scripts, | ||
ScrollRestoration, | ||
} from "@remix-run/react"; | ||
import stylesheet from "~/tailwind.css?url"; | ||
import { Nav } from "./components/nav"; | ||
import { Footer } from "./components/footer"; | ||
|
||
export const links: LinksFunction = () => [ | ||
{ rel: "stylesheet", href: stylesheet }, | ||
]; | ||
|
||
export function Layout({ children }: { children: React.ReactNode }) { | ||
return ( | ||
<html lang="en"> | ||
<head> | ||
<meta charSet="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<Meta /> | ||
<Links /> | ||
</head> | ||
<body className="bg-tertiary"> | ||
{children} | ||
<ScrollRestoration /> | ||
<Scripts /> | ||
</body> | ||
</html> | ||
); | ||
} | ||
|
||
export default function App() { | ||
return ( | ||
<div className="m-0 h-svh w-svw p-0 font-mono text-primary"> | ||
<div className="relative mx-auto flex h-full w-full flex-col"> | ||
<Nav /> | ||
<main className="mx-auto h-full w-full flex-1 overflow-auto"> | ||
<div className="mx-auto w-full max-w-7xl px-6 sm:px-16"> | ||
<Outlet /> | ||
</div> | ||
</main> | ||
<Footer className="sm:px mx-auto flex w-full max-w-7xl px-6 py-2" /> | ||
</div> | ||
</div> | ||
); | ||
} | ||
import { captureRemixErrorBoundaryError } from "@sentry/remix"; | ||
import { LinksFunction } from "@remix-run/cloudflare"; | ||
import { Links, Meta, Outlet, Scripts, ScrollRestoration, useRouteError } from "@remix-run/react"; | ||
import stylesheet from "~/tailwind.css?url"; | ||
import { Nav } from "./components/nav"; | ||
import { Footer } from "./components/footer"; | ||
|
||
export const links: LinksFunction = () => [ | ||
{ rel: "stylesheet", href: stylesheet }, | ||
]; | ||
|
||
export function Layout({ children }: { children: React.ReactNode }) { | ||
return ( | ||
<html lang="en"> | ||
<head> | ||
<meta charSet="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<Meta /> | ||
<Links /> | ||
</head> | ||
<body className="bg-tertiary"> | ||
{children} | ||
<ScrollRestoration /> | ||
<Scripts /> | ||
</body> | ||
</html> | ||
); | ||
} | ||
|
||
export const ErrorBoundary = () => { | ||
const error = useRouteError(); | ||
captureRemixErrorBoundaryError(error); | ||
return <div>Something went wrong</div>; | ||
}; | ||
|
||
export default function App() { | ||
return ( | ||
<div className="m-0 h-svh w-svw p-0 font-mono text-primary"> | ||
<div className="relative mx-auto flex h-full w-full flex-col"> | ||
<Nav /> | ||
<main className="mx-auto h-full w-full flex-1 overflow-auto"> | ||
<div className="mx-auto w-full max-w-7xl px-6 sm:px-16"> | ||
<Outlet /> | ||
</div> | ||
</main> | ||
<Footer className="sm:px mx-auto flex w-full max-w-7xl px-6 py-2" /> | ||
</div> | ||
</div> | ||
); | ||
} |
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,7 @@ | ||
import * as Sentry from "@sentry/remix"; | ||
|
||
Sentry.init({ | ||
dsn: "https://5f711f23dca8cae55c3ef1c0dde80b4e@o4507639875239936.ingest.us.sentry.io/4507639877992448", | ||
tracesSampleRate: 1, | ||
autoInstrumentRemix: true | ||
}) |
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
Oops, something went wrong.