@@ -68,7 +66,9 @@ export default async function NotFound() {
/>
-
+
+
+
>
);
}
diff --git a/core/components/footer/footer.tsx b/core/components/footer/footer.tsx
index 97558f63a..baf9cf215 100644
--- a/core/components/footer/footer.tsx
+++ b/core/components/footer/footer.tsx
@@ -9,7 +9,11 @@ import {
} from '@icons-pack/react-simple-icons';
import { JSX } from 'react';
-import { FragmentOf } from '~/client/graphql';
+import { LayoutQuery } from '~/app/[locale]/(default)/query';
+import { getSessionCustomerId } from '~/auth';
+import { client } from '~/client';
+import { readFragment } from '~/client/graphql';
+import { revalidate } from '~/client/revalidate-target';
import { Footer as ComponentsFooter } from '~/components/ui/footer';
import { logoTransformer } from '~/data-transformers/logo-transformer';
@@ -31,11 +35,16 @@ const socialIcons: Record
= {
YouTube: { icon: },
};
-interface Props {
- data: FragmentOf;
-}
+export const Footer = async () => {
+ const customerId = await getSessionCustomerId();
+
+ const { data: response } = await client.fetch({
+ document: LayoutQuery,
+ fetchOptions: customerId ? { cache: 'no-store' } : { next: { revalidate } },
+ });
+
+ const data = readFragment(FooterFragment, response).site;
-export const Footer = ({ data }: Props) => {
const sections = [
{
title: 'Categories',
diff --git a/core/components/header/index.tsx b/core/components/header/index.tsx
index 237f07dcf..8f24088e4 100644
--- a/core/components/header/index.tsx
+++ b/core/components/header/index.tsx
@@ -2,8 +2,11 @@ import { ShoppingCart, User } from 'lucide-react';
import { getLocale, getTranslations } from 'next-intl/server';
import { ReactNode, Suspense } from 'react';
+import { LayoutQuery } from '~/app/[locale]/(default)/query';
import { getSessionCustomerId } from '~/auth';
-import { FragmentOf } from '~/client/graphql';
+import { client } from '~/client';
+import { readFragment } from '~/client/graphql';
+import { revalidate } from '~/client/revalidate-target';
import { logoTransformer } from '~/data-transformers/logo-transformer';
import { localeLanguageRegionMap } from '~/i18n/routing';
@@ -19,15 +22,20 @@ import { QuickSearch } from './quick-search';
interface Props {
cart: ReactNode;
- data: FragmentOf;
}
-export const Header = async ({ cart, data }: Props) => {
+export const Header = async ({ cart }: Props) => {
const locale = await getLocale();
const t = await getTranslations('Components.Header');
-
const customerId = await getSessionCustomerId();
+ const { data: response } = await client.fetch({
+ document: LayoutQuery,
+ fetchOptions: customerId ? { cache: 'no-store' } : { next: { revalidate } },
+ });
+
+ const data = readFragment(HeaderFragment, response).site;
+
/** To prevent the navigation menu from overflowing, we limit the number of categories to 6.
To show a full list of categories, modify the `slice` method to remove the limit.
Will require modification of navigation menu styles to accommodate the additional categories.
@@ -97,3 +105,27 @@ export const Header = async ({ cart, data }: Props) => {
/>
);
};
+
+export const HeaderSkeleton = () => (
+
+);