feat(GrowTentKonfigurator): add category load status tracking

Introduce categoryLoadStatus state to track loading for product categories.
Replace forceUpdate with setState to properly update loading status on socket response.
This commit is contained in:
sebseb7
2025-09-09 11:39:44 +02:00
parent 9d93ab8f2c
commit 77ffe864b1

View File

@@ -76,7 +76,13 @@ class GrowTentKonfigurator extends Component {
selectedLightType: savedState?.selectedLightType || 'led_quantum_board',
selectedVentilationType: savedState?.selectedVentilationType || 'premium_ventilation',
selectedExtras: savedState?.selectedExtras || [],
totalPrice: savedState?.totalPrice || 0
totalPrice: savedState?.totalPrice || 0,
categoryLoadStatus: {
"Zelte": false,
"Lampen": false,
"Abluft-sets": false,
"Set-zubehoer": false
}
};
this.handleTentShapeSelect = this.handleTentShapeSelect.bind(this);
@@ -160,7 +166,12 @@ class GrowTentKonfigurator extends Component {
window.socketManager.on(`productList:${categoryId}`,(response) => {
setCachedCategoryData(categoryId, response);
this.forceUpdate();
this.setState(prevState => ({
categoryLoadStatus: {
...prevState.categoryLoadStatus,
[categoryId]: true
}
}));
});
const currentLanguage = this.props.languageContext?.currentLanguage || this.props.i18n?.language || 'de';