feat: update product detail caching and component loading logic for improved SPA performance

This commit is contained in:
sebseb7
2025-07-20 00:10:55 +02:00
parent 055e49c957
commit 8e6e020a1b
3 changed files with 45 additions and 18 deletions

View File

@@ -207,10 +207,11 @@ const renderPage = (
// Create script to populate window.productDetailCache for individual product pages
let productDetailCacheScript = '';
if (productData && productData.product) {
const productDetailCacheData = JSON.stringify(productData.product);
// Cache the entire response object (includes product, attributes, etc.)
const productDetailCacheData = JSON.stringify(productData);
productDetailCacheScript = `
<script>
// Populate window.productDetailCache with product data for SPA hydration
// Populate window.productDetailCache with complete product data for SPA hydration
if (!window.productDetailCache) {
window.productDetailCache = {};
}