refactor: remove socket.io method overrides in Content component to streamline category data fetching and improve code clarity
This commit is contained in:
@@ -229,39 +229,6 @@ class Content extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CRITICAL: Override socket.io methods if we have the cache
|
|
||||||
if (window.productCache &&
|
|
||||||
window.productCache["categoryTree_209"] &&
|
|
||||||
window.productCache["categoryTree_209"].categoryTree) {
|
|
||||||
console.log("🚫 OVERRIDING SOCKET.IO METHODS - Cache exists");
|
|
||||||
|
|
||||||
// Create backup of original methods
|
|
||||||
if (!window._originalSocketEmit && window.socketManager) {
|
|
||||||
window._originalSocketEmit = window.socketManager.emit;
|
|
||||||
|
|
||||||
// Override emit method to prevent categoryList calls
|
|
||||||
window.socketManager.emit = (event, data, callback) => {
|
|
||||||
if (event === "getCategoryProducts") {
|
|
||||||
console.log("🚫 BLOCKED getCategoryProducts socket call");
|
|
||||||
if (callback) {
|
|
||||||
// Return empty response to satisfy callback
|
|
||||||
setTimeout(() => {
|
|
||||||
callback({
|
|
||||||
products: [],
|
|
||||||
attributes: [],
|
|
||||||
categoryName: "Cached Category"
|
|
||||||
});
|
|
||||||
}, 0);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pass through other events
|
|
||||||
return window._originalSocketEmit.call(window.socketManager, event, data, callback);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.props.params.categoryId) {this.setState({loaded: false, unfilteredProducts: [], filteredProducts: [], attributes: [], categoryName: null, childCategories: []}, () => {
|
if(this.props.params.categoryId) {this.setState({loaded: false, unfilteredProducts: [], filteredProducts: [], attributes: [], categoryName: null, childCategories: []}, () => {
|
||||||
this.fetchCategoryData(this.props.params.categoryId);
|
this.fetchCategoryData(this.props.params.categoryId);
|
||||||
})}
|
})}
|
||||||
|
|||||||
Reference in New Issue
Block a user