Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions src/routes/__root.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createRootRoute, HeadContent, Scripts } from "@tanstack/react-router";
import { createRootRoute, HeadContent, Outlet, Scripts } from "@tanstack/react-router";
import Footer from "../components/Footer";
import Header from "../components/Header";
import JsonLd from "../components/JsonLd";
Expand Down Expand Up @@ -51,11 +51,11 @@ export const Route = createRootRoute({
],
scripts: [{ src: "/theme-init.js" }],
}),
shellComponent: RootDocument,
shellComponent: RootShell,
component: RootLayout,
});

function RootDocument({ children }: { children: React.ReactNode }) {
const stars = Route.useLoaderData();
function RootShell({ children }: { children: React.ReactNode }) {
return (
<html
lang="en"
Expand All @@ -66,14 +66,23 @@ function RootDocument({ children }: { children: React.ReactNode }) {
<head>
<HeadContent />
</head>
<body className="flex min-h-screen flex-col font-sans antialiased [overflow-wrap:anywhere] selection:bg-[rgba(253,54,110,0.2)]">
<body className="flex min-h-screen flex-col font-sans antialiased wrap-anywhere selection:bg-[rgba(253,54,110,0.2)]">
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[overflow-wrap:anywhere] and wrap-anywhere are equivalent canonical classes, no style change.

<JsonLd data={WEBSITE_JSON_LD} />
<PlausibleAnalytics />
<Header stars={stars} />
{children}
<Footer />
<Scripts />
</body>
</html>
);
}

function RootLayout() {
const stars = Route.useLoaderData();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

Love the effort! But it seems we still have same problem on preview 🤔 Feel free to PM me if you have som ideas/questions.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! it works perfectly on my side locally. if it still doesn't work on preview, maybe we can try:

<Header stars={typeof stars === "number" ? stars : 0} />

return (
<>
<Header stars={stars} />
<Outlet />
<Footer />
</>
);
}
Loading