This commit is contained in:
sebseb7
2025-07-23 09:50:37 +02:00
parent b5a78b33cb
commit cd4d124e22

View File

@@ -259,19 +259,15 @@ class Content extends Component {
fetchCategoryData(categoryId) {
// Simply check if we have any category tree data in window.productCache
const hasCategoryTree = window.productCache &&
Object.keys(window.productCache).some(key =>
key.startsWith("categoryTree_209") &&
window.productCache[key] &&
window.productCache[key].categoryTree);
// Direct check for the specific cache key mentioned in the requirement
const hasCategoryTree = window.productCache && window.productCache["categoryTree_209"];
// Check for specific category data in cache
const cachedData = getCachedCategoryData(categoryId);
// If we have the category tree data, use it and don't query socket.io
if (hasCategoryTree) {
console.log("Found category tree in cache");
console.log("Found categoryTree_209 in cache");
if (cachedData) {
console.log("Using cached category data for", categoryId);
@@ -414,22 +410,12 @@ class Content extends Component {
// Helper function to get category name from tree
getCategoryNameFromTree = (categoryId) => {
if (!window.productCache) {
if (!window.productCache || !window.productCache["categoryTree_209"] ||
!window.productCache["categoryTree_209"].categoryTree) {
return null;
}
// Find the first available category tree
const categoryTreeKey = Object.keys(window.productCache).find(key =>
key.startsWith("categoryTree_209") &&
window.productCache[key] &&
window.productCache[key].categoryTree
);
if (!categoryTreeKey) {
return null;
}
const categoryTree = window.productCache[categoryTreeKey].categoryTree;
const categoryTree = window.productCache["categoryTree_209"].categoryTree;
// If categoryId is a string (SEO name), find by seoName, otherwise by ID
const category = typeof categoryId === 'string'