fix(ecommerce): forzar renderizado dinamico en home y layout raiz #35
No files matched your search
@@ -6,6 +6,13 @@ import { Navbar } from "@/components/layout/navbar";
|
|||||||
import { WishlistDrawer } from "@/components/wishlist/wishlist-drawer";
|
import { WishlistDrawer } from "@/components/wishlist/wishlist-drawer";
|
||||||
import { getCategories, getProducts } from "@/lib/headless/client";
|
import { getCategories, getProducts } from "@/lib/headless/client";
|
||||||
|
|
||||||
|
// El Navbar (categorias/colecciones/predictive search) vive en este layout
|
||||||
|
// compartido -- si alguna pagina futura queda estatica, este fetch se
|
||||||
|
// congelaria con datos de build time (mock) igual que le paso al home
|
||||||
|
// (ver app/page.tsx). Forzarlo aca protege el nav en cualquier ruta, no
|
||||||
|
// solo en las que hoy ya son dinamicas por otro motivo (searchParams, etc.).
|
||||||
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
metadataBase: new URL(process.env.NEXT_PUBLIC_SITE_URL ?? "https://shop.cruzcloud.net"),
|
metadataBase: new URL(process.env.NEXT_PUBLIC_SITE_URL ?? "https://shop.cruzcloud.net"),
|
||||||
title: { default: "ARI Shopping | Juguetes, regalos y variedades", template: "%s | ARI Shopping" },
|
title: { default: "ARI Shopping | Juguetes, regalos y variedades", template: "%s | ARI Shopping" },
|
||||||
|
|||||||
@@ -7,6 +7,13 @@ import { ProductCarousel } from "@/components/product/product-carousel";
|
|||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { getCategories, getProducts } from "@/lib/headless/client";
|
import { getCategories, getProducts } from "@/lib/headless/client";
|
||||||
|
|
||||||
|
// Sin esto, Next.js prerenderiza "/" en build time dentro del Dockerfile,
|
||||||
|
// donde HEADLESS_PROVIDER/MEDUSA_* todavia no existen (solo se inyectan en
|
||||||
|
// runtime via el Deployment) -- cae al provider mock y ese HTML queda
|
||||||
|
// cacheado 1 año (visto en vivo: x-nextjs-prerender:1, s-maxage=31536000),
|
||||||
|
// violando el flujo Admin -> revalidate del ADR 0005 justo en el home.
|
||||||
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
export default async function HomePage() {
|
export default async function HomePage() {
|
||||||
const [products, categories] = await Promise.all([getProducts(), getCategories()]);
|
const [products, categories] = await Promise.all([getProducts(), getCategories()]);
|
||||||
const treasures = products.filter((product) => product.isNew || product.featured).slice(0, 8);
|
const treasures = products.filter((product) => product.isNew || product.featured).slice(0, 8);
|
||||||
|
|||||||
Reference in new issue
Block a user