feat(application): implement Phase 3 strict DTOs, eradicate any types, and add Suspense boundaries
Deploy Canina / deploy (push) Failing after 29s

This commit is contained in:
parsa committed 2026-08-06 23:15:25 +03:30
1 parent 57596f5aaf
commit 74fcaa6a4e
8 files changed
+82 -24

No files matched your search

+25 -7
View File
@@ -1,6 +1,7 @@
import ProductPage from "../../../components/ProductPage";
import { productService } from "../../../lib/services/productService";
import type { Metadata, ResolvingMetadata } from 'next';
import { Suspense } from 'react';
export async function generateMetadata(
{ params }: { params: Promise<{ slug: string }> },
@@ -15,14 +16,12 @@ export async function generateMetadata(
};
}
// Get raw data for custom fields if we added them (like metaTitle)
// Since we don't have local access to raw DB object without modifying productService,
// we can just use the mapped product fields for now.
const nameFa = product.nameFa || product.name;
const nameEn = product.nameEn || "";
const title = nameFa.includes("Canina") ? nameFa : `${nameFa} (${nameEn}) | برند کانینا آلمان`;
const description = (product.shortDescription || product.description || '').substring(0, 150).trim();
const keywords = (product as any).keywords ? (product as any).keywords.split(',') : product.main_ingredients;
const rawKeywords = (product as unknown as Record<string, unknown>).keywords;
const keywords = typeof rawKeywords === 'string' ? rawKeywords.split(',') : product.main_ingredients;
return {
title,
@@ -106,17 +105,36 @@ export default async function ShopProductPage({ params }: { params: Promise<{ sl
]
};
const safeProductJsonLd = JSON.stringify(productJsonLd).replace(/</g, '\\u003c');
const safeBreadcrumbJsonLd = JSON.stringify(breadcrumbJsonLd).replace(/</g, '\\u003c');
return (
<>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(productJsonLd) }}
dangerouslySetInnerHTML={{ __html: safeProductJsonLd }}
/>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(breadcrumbJsonLd) }}
dangerouslySetInnerHTML={{ __html: safeBreadcrumbJsonLd }}
/>
<ProductPage productSlug={resolvedParams.slug} />
<Suspense fallback={
<div className="min-h-screen bg-medical-gray-50 p-6 max-w-7xl mx-auto font-vazir" dir="rtl">
<div className="animate-pulse space-y-6">
<div className="h-8 bg-medical-gray-200 rounded-2xl w-48" />
<div className="grid md:grid-cols-12 gap-8">
<div className="md:col-span-5 h-80 bg-white border border-medical-gray-200 rounded-[2.5rem]" />
<div className="md:col-span-7 space-y-4">
<div className="h-10 bg-medical-gray-200 rounded-2xl w-3/4" />
<div className="h-6 bg-medical-gray-100 rounded-xl w-1/2" />
<div className="h-24 bg-medical-gray-100 rounded-2xl w-full" />
</div>
</div>
</div>
</div>
}>
<ProductPage productSlug={resolvedParams.slug} />
</Suspense>
</>
);
}