feat: enhance language support in data fetching across components
- Updated Content, ProductDetailPage, and GrowTentKonfigurator to include current language context when emitting WebSocket requests for product and category data. - Improved caching logic to ensure fresh data loading based on language changes. - Enhanced localization by adding language parameters to data requests, improving user experience across different languages.
This commit is contained in:
@@ -181,17 +181,10 @@ class ProductDetailPage extends Component {
|
||||
if (prevLanguage !== currentLanguage) {
|
||||
console.log('Language changed from', prevLanguage, 'to', currentLanguage, '- reloading product data');
|
||||
|
||||
// Clear relevant caches to force fresh socket calls with new language
|
||||
if (window.productDetailCache) {
|
||||
// Clear cache for current product
|
||||
delete window.productDetailCache[this.props.seoName];
|
||||
|
||||
// Clear cache for any komponenten if they exist
|
||||
if (this.state.komponenten && this.state.komponenten.length > 0) {
|
||||
this.state.komponenten.forEach(komponent => {
|
||||
delete window.productDetailCache[komponent.id];
|
||||
});
|
||||
}
|
||||
// Clear caches globally to force fresh socket calls with new language
|
||||
if (typeof window !== 'undefined') {
|
||||
window.productCache = {};
|
||||
window.productDetailCache = {};
|
||||
}
|
||||
|
||||
// Reset component state and reload data
|
||||
|
||||
Reference in New Issue
Block a user