refactor: implement CategoryService for category data management and update caching logic in prerender and renderer components
This commit is contained in:
@@ -19,6 +19,24 @@ global.Blob = class MockBlob {
|
||||
}
|
||||
};
|
||||
|
||||
class CategoryService {
|
||||
constructor() {
|
||||
this.get = this.get.bind(this);
|
||||
}
|
||||
|
||||
getSync(categoryId, language = "de") {
|
||||
const cacheKey = `${categoryId}_${language}`;
|
||||
return null;
|
||||
}
|
||||
|
||||
async get(categoryId, language = "de") {
|
||||
const cacheKey = `${categoryId}_${language}`;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
global.window.categoryService = new CategoryService();
|
||||
|
||||
|
||||
// Import modules
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
@@ -350,14 +368,14 @@ const renderProductsInParallel = async (allProductsArray, maxWorkers, totalProdu
|
||||
|
||||
const renderApp = async (categoryData, socket) => {
|
||||
if (categoryData) {
|
||||
global.window.productCache = {
|
||||
categoryTree_209: { categoryTree: categoryData, timestamp: Date.now() },
|
||||
global.window.categoryCache = {
|
||||
"209_de": categoryData,
|
||||
};
|
||||
// @note Make cache available to components during rendering
|
||||
global.productCache = global.window.productCache;
|
||||
global.categoryCache = global.window.categoryCache;
|
||||
} else {
|
||||
global.window.productCache = {};
|
||||
global.productCache = {};
|
||||
global.window.categoryCache = {};
|
||||
global.categoryCache = {};
|
||||
}
|
||||
|
||||
// Helper to call renderPage with config
|
||||
|
||||
Reference in New Issue
Block a user