refactor: enhance logging and cache checks in SharedCarousel and CategoryList components to improve data fetching clarity and performance
This commit is contained in:
@@ -85,12 +85,14 @@ const SharedCarousel = () => {
|
||||
|
||||
// Use cache if available
|
||||
if (categoryTree) {
|
||||
console.log('SharedCarousel: Using cached category tree');
|
||||
setRootCategories(processCategoryTree(categoryTree));
|
||||
return;
|
||||
}
|
||||
|
||||
// Only fetch if needed
|
||||
if (rootCategories.length === 0 && typeof window !== "undefined") {
|
||||
console.log('SharedCarousel: Cache not found, fetching from socket');
|
||||
window.socketManager.emit("categoryList", { categoryId: 209, language: currentLanguage, requestTranslation: true }, (response) => {
|
||||
if (response && response.success) {
|
||||
// Use translated data if available, otherwise fall back to original
|
||||
|
||||
Reference in New Issue
Block a user