Components: Pages
Page-level content shared between a route and its loading state: product, category and blog post pages, skeletons and the not-found page.
Generated from apps/theme/src/components/pages/: 8 files, 8 components. Import a component through the @/components/… path shown, so a fork can override it in src/custom/.
@/components/pages/blog-post-loading-skeleton
apps/theme/src/components/pages/blog-post-loading-skeleton.tsx server component
<BlogPostLoadingSkeleton>
Blog post route-level placeholder — the "nothing is known about this post yet" branch of app/[locale]/blog/[slug]/loading.tsx: a hard load, a direct entry, a crawler, or any navigation without a preceding post-card click. (When a card WAS clicked, OptimisticBlogPostHero paints the real image, date, author and title instead — see lib/pending-post.ts.)
Mirrors blog/[slug]/page.tsx:
Container(size="full" py-10) → back link(mb-8)
→ article(mx-auto max-w-3xl) → hero aspect-[16/9](mb-8)
→ meta row(mb-6) → h1(mb-4) → body
The article column is max-w-3xl and centred; painting full-width lines here would re-flow the entire post on swap. The hero is reserved at its real aspect ratio because the image is priority — reserving it is what keeps the LCP element from shifting.
No props.
@/components/pages/category-page-content
apps/theme/src/components/pages/category-page-content.tsx server component
<CategoryPageContent>
| Prop | Type | Description |
|---|---|---|
category | CategoryTree | |
products | ProductsOutput | |
aggregationsPromise | Promise<CategoryAggregations> | Layered-nav facets, fetched separately and streamed into the filter toolbar so the product grid renders without waiting on facet computation. |
currentPage | number | |
currentSort | string | |
hrefForPage | (page: number) => string | Build the URL for a given (1-based) page number, preserving the active sort/filters (see categoryHref in the route's page.tsx). |
promoBlocks? | CmsBlock[] | Optional CMS promo blocks to inject into the product grid as ad panels. |
specialProduct? | ProductInterface | null | Product flagged special, shown as a wide card in the first two grid cells on md+ and full-width above the grid on mobile. The page size already accounts for it (lib/category-grid.ts); omit it and products fill the cells. |
blogPosts? | BlogPost[] | Optional blog posts to display before the footer. |
@/components/pages/not-found-content
apps/theme/src/components/pages/not-found-content.tsx client component
<NotFoundContent>
The shared, enhanced 404 body. Rendered by BOTH:
app/[locale]/not-found.tsx— for in-appnotFound()throws (streamed, inside the site chrome; the provider tree comes from the layout).app/global-not-found.tsx— for unmatched URLs (a real 404 status, non-streamed; that file mounts the minimal providers this needs).
Everything here is client-side (search navigation + Apollo-fetched recommendations), so it never suspends on the server — which is what lets the global-not-found document commit a real 404 status before the browser then hydrates the recommendation rows.
No props.
@/components/pages/optimistic-blog-post-hero
apps/theme/src/components/pages/optimistic-blog-post-hero.tsx client component
<OptimisticBlogPostHero>
The optimistic half of the blog post loading boundary.
blog-post-card-link.tsx writes the clicked card into lib/pending-post.ts on pointerdown; this reads it back and paints the real header — headline image, date, author, title — while the RSC payload for the post is still in flight. Only the body copy stays skeletal, because that genuinely is not known yet: BLOG_POST_CARD_FIELDS carries no post_content.
── The stacked image, and why ──
image-loader.ts output is a pure function of (pathname, width, quality), so the card and the post hero resolve the same file to the same path. Only the sizes string differs, and sizes decides which srcset candidate the browser picks: the card declares …50vw, 33vw and the post hero …100vw, 768px. They agree at ≤640px and diverge above it, so above 640px the two request different URLs.
Using the card's sizes alone paints instantly from cache, but the committed page would then request a width nothing has cached — and because the loading boundary unmounts wholesale there is no <img> continuity to carry the old pixels, so the headline image visibly reloads at commit. Hence two layers:
- underneath, the card's exact
src+sizes— a guaranteed cache hit that paints in the first frame; - on top, the POST's
sizes— a no-op at ≤640px (same candidate), and above it the fetch for the variant the real page wants, started during the loading state instead of at commit.
The extra element cannot contend with the cold-load LCP preload of the real hero (which is priority), because this component only ever renders on a SOFT navigation: on a hard load the store is empty and loading.tsx renders BlogPostLoadingSkeleton instead.
Keep the markup in step with app/[locale]/blog/[slug]/page.tsx — every wrapper and margin here is copied from it so committing the real post moves nothing that is already on screen.
| Prop | Type | Description |
|---|---|---|
fallback | ReactNode | Rendered when there is no usable snapshot — a hard load, a direct entry, a crawler, or a navigation that didn't start from a post card. Passed in as a server element from loading.tsx so the skeleton stays out of the client tree. |
@/components/pages/optimistic-product-hero
apps/theme/src/components/pages/optimistic-product-hero.tsx client component
<OptimisticProductHero>
The optimistic half of the PDP loading boundary.
product-card.tsx writes the clicked card into lib/pending-product.ts on pointerdown; this reads it back and paints a real hero — image, badges, title, rating, price with the Omnibus disclosure — while the RSC payload for the actual page is still in flight. The rest of the column (options, quantity, add-to-cart) stays skeletal because that data genuinely is not known yet.
── The stacked image, and why ──
image-loader.ts output is a pure function of (pathname, width, quality), and this store serves product media directly to imgproxy, so the hero and the real gallery resolve the same file to the same path. Only the sizes string differs, and sizes is what decides which srcset candidate the browser picks: the card declares …50vw, 25vw and the gallery …100vw, 50vw. Those agree at ≤640px (both 100vw) and diverge above it — so above 640px the two request different widths, i.e. different URLs.
A first cut used the card's sizes alone. That paints instantly from cache, but on desktop the real gallery then requests a width nothing has cached, and because the loading boundary unmounts wholesale there is no <img> continuity to carry the old pixels — so the image visibly reloaded at commit. That was the reported defect.
So two layers:
- underneath, the card's exact
src+sizes.next/imageresolves the same candidate the listing already fetched, so this is a guaranteed cache hit and paints in the first frame. Reusing the card'ssizesstring verbatim — rather than guessing a pixel width — is what makes the hit hold across viewport and DPR. - on top, the GALLERY's
sizes. At ≤640px this resolves to the same candidate as the layer below, so it costs nothing. Above 640px it starts the fetch for the variantProductGallerywill want, during the loading state instead of at commit.
Net: instant paint at every breakpoint, at most one sharpen inside the loading state, and nothing changing at commit — the gallery's URL is already in cache by then.
The extra element cannot contend with the cold-load LCP preload that product-gallery.tsx and its thumbnail strip are careful about, because this component only ever renders on a SOFT navigation: on a hard load the store is empty and loading.tsx renders ProductLoadingSkeleton instead.
This is a loading state and can never be the last thing on screen: it is replaced the instant the route commits, and if getProductBySlug returns null the route calls notFound() and this is replaced by the 404.
| Prop | Type | Description |
|---|---|---|
fallback | ReactNode | Rendered when there is no usable snapshot — a hard load, a direct entry, a crawler, or a navigation that didn't start from a product card. Passed in as a server element from loading.tsx (the same server-element-as-prop technique product-page-content.tsx uses for its gallery prop) so the skeleton stays out of the client tree. |
@/components/pages/product-deferred-sections
apps/theme/src/components/pages/product-deferred-sections.tsx server component
<ProductReviewsSection>
Reviews plus the product JSON-LD.
These two travel together on purpose: ProductSchema carries the individual review markup that drives review rich results, so it must resolve with the reviews and — critically — must be SERVER-rendered. That is why reviews stayed on the streamed path when the linked-product grids moved behind a viewport gate: a non-rendering crawler must still find this markup in the HTML.
The reviews query is cheap (one product's reviews), fails soft to empty, and since the 2026-08-14 split no longer shares a failure domain with the three linked-product resolutions — a slow related-products resolver can no longer silently empty the reviews block and strip the review array out of the JSON-LD. The aggregate rating derives from the main product's review_count / rating_summary, so stars are unaffected by this query's latency either way.
| Prop | Type | Description |
|---|---|---|
product | ProductInterface | |
reviewsPromise | Promise<ProductReviewsResult> |
@/components/pages/product-loading-skeleton
apps/theme/src/components/pages/product-loading-skeleton.tsx server component
<ProductLoadingSkeleton>
PDP route-level placeholder — the "we know nothing about this product yet" branch of app/[locale]/product/[slug]/loading.tsx. It is what a hard load, a direct entry, a crawler, or any navigation without a preceding product-card click gets. (When a card WAS clicked, OptimisticProductHero paints the real image/title/price instead — see lib/pending-product.ts.)
It mirrors the real page's wrappers and responsive grid so the swap to content doesn't reflow: <Container size="full" className="py-10"> from ProductPageContent, the breadcrumb row (mb-8), and ProductInfoColumn's grid-cols-1 … lg:grid-cols-2 lg:gap-x-16 with gap-y-6, and ProductGallery's left thumbnail rail on lg+.
A previous version was grid grid-cols-2 gap-16 inside a bare max-w-[1440px] px-8 div — no responsive variants — so on mobile it painted a squeezed two-column split that the real (stacked) page then had to undo: a large mobile layout shift on every navigation into a product page.
Source order matches ProductInfoColumn on mobile: header → gallery → actions. OptimisticProductHero mirrors this same structure — keep the two in step.
No props.
@/components/pages/product-page-content
apps/theme/src/components/pages/product-page-content.tsx server component
<ProductPageContent>
| Prop | Type | Description |
|---|---|---|
product | ProductInterface | |
reviewsPromise | Promise<ProductReviewsResult> | Below-the-fold reviews, fetched without awaiting in the route so the product hero (LCP) streams first; resolved inside <Suspense>. Reviews stay on the server path because ProductSchema emits their markup for rich results. The linked-product grids and related blog posts are NOT here — they are fetched client-side on scroll, see ProductLinkedGrids / ProductBlogRail. |
couponDealsPromise? | Promise<CouponDeal[]> | Coupon deals for the store view (one cached list, not per product). Only the unconditional ones are shown, under the price, streamed via <Suspense> so they never hold up the hero. Omitted: no strip. |