Skip to content

Commit

Permalink
fix: updating layout export in root
Browse files Browse the repository at this point in the history
  • Loading branch information
DonKoko committed Aug 16, 2024
1 parent 0abdda1 commit 78157a8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
13 changes: 5 additions & 8 deletions app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { PropsWithChildren } from "react";
import type { User } from "@prisma/client";
import type {
LinksFunction,
Expand All @@ -14,6 +13,7 @@ import {
Scripts,
ScrollRestoration,
useLoaderData,
useRouteLoaderData,
} from "@remix-run/react";
import { withSentry } from "@sentry/remix";
import nProgressStyles from "nprogress/nprogress.css?url";
Expand Down Expand Up @@ -77,8 +77,8 @@ export const loader = ({ request }: LoaderFunctionArgs) =>

export const shouldRevalidate = () => false;

function Document({ children, title }: PropsWithChildren<{ title?: string }>) {
const { env } = useLoaderData<typeof loader>();
export function Layout({ children }: { children: React.ReactNode }) {
const data = useRouteLoaderData<typeof loader>("root");
const nonce = useNonce();
return (
<html lang="en" className="h-full">
Expand All @@ -88,7 +88,6 @@ function Document({ children, title }: PropsWithChildren<{ title?: string }>) {
<ClientHintCheck nonce={nonce} />
<style data-fullcalendar />
<Meta />
{title ? <title>{title}</title> : null}
<Links />
<Clarity />
</head>
Expand All @@ -97,7 +96,7 @@ function Document({ children, title }: PropsWithChildren<{ title?: string }>) {
<ScrollRestoration />
<script
dangerouslySetInnerHTML={{
__html: `window.env = ${JSON.stringify(env)}`,
__html: `window.env = ${JSON.stringify(data?.env)}`,
}}
/>
<Scripts />
Expand All @@ -110,9 +109,7 @@ function App() {
useNprogress();
const { maintenanceMode } = useLoaderData<typeof loader>();

return (
<Document>{maintenanceMode ? <MaintenanceMode /> : <Outlet />}</Document>
);
return maintenanceMode ? <MaintenanceMode /> : <Outlet />;
}

export default withSentry(App);
Expand Down
3 changes: 3 additions & 0 deletions app/routes/qr+/route.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Link, Outlet } from "@remix-run/react";
import { ErrorContent } from "~/components/errors";
import { ShelfFullLogo } from "~/components/marketing/logos";
import { usePosition } from "~/hooks/use-position";

Expand All @@ -20,3 +21,5 @@ export default function QR() {
</div>
);
}

export const ErrorBoundary = () => <ErrorContent />;

0 comments on commit 78157a8

Please sign in to comment.