Skip to content

Commit

Permalink
fix: use fast-npm-meta in SSR
Browse files Browse the repository at this point in the history
  • Loading branch information
pheralb committed Jul 2, 2024
1 parent 3e77c35 commit 0b7f419
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions website/app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ import {
ScrollRestoration,
useLoaderData,
} from '@remix-run/react';
import { getLatestVersion } from 'fast-npm-meta';

// Styles:
import stylesheet from '@/styles/globals.css?url';
import { cn } from './utils';

// Layout:
import Header from './components/header';
import SidebarContent from './components/sidebar';
import SidebarContent from './components/sidebar/sidebar';
import { proseClasses } from './ui/prose';

// Providers:
Expand All @@ -40,8 +41,10 @@ export const links: LinksFunction = () => [

export async function loader({ request }: LoaderFunctionArgs) {
const { getTheme } = await themeSessionResolver(request);
const metadata = await getLatestVersion('@pheralb/toast');
return {
theme: getTheme(),
npmVersion: metadata.version,
};
}

Expand Down Expand Up @@ -82,7 +85,7 @@ function App() {
<Header />
<main className="container w-full max-w-7xl">
<aside className="hidden md:block">
<SidebarContent />
<SidebarContent npmVersion={data.npmVersion!} />
</aside>
<MDXProvider disableParentContext components={mdxComponents}>
<article
Expand Down

0 comments on commit 0b7f419

Please sign in to comment.