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:
sebseb7
2025-08-09 10:06:43 +02:00
parent d40e311b51
commit 2ac9baada0
3 changed files with 16 additions and 14 deletions

View File

@@ -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