Refactor betterPricesMap updates in RevenueSection for Vue 3 reactivity

- Updated the handling of betterPricesMap to create a new object for state updates, ensuring reactivity in Vue 3.
- This change replaces direct assignments with spread operator syntax to maintain the integrity of the reactive system.
- Aims to improve performance and align with Vue 3 best practices for state management.
This commit is contained in:
Torsten Schulz (local)
2025-12-03 16:15:01 +01:00
parent 7fab23d22b
commit 6b3b30108b

View File

@@ -131,11 +131,17 @@
} }
}); });
// Speichere betterPrices in einem separaten Map, nicht auf dem product Objekt // Speichere betterPrices in einem separaten Map, nicht auf dem product Objekt
// In Vue 3 ist $set nicht mehr nötig, direkte Zuweisung funktioniert // In Vue 3 müssen wir ein neues Objekt erstellen, um die Reaktivität zu triggern
this.betterPricesMap[product.id] = data || []; this.betterPricesMap = {
...this.betterPricesMap,
[product.id]: data || []
};
} catch (error) { } catch (error) {
console.error(`Error loading prices for product ${product.id}:`, error); console.error(`Error loading prices for product ${product.id}:`, error);
this.betterPricesMap[product.id] = []; this.betterPricesMap = {
...this.betterPricesMap,
[product.id]: []
};
} finally { } finally {
this.loadingPrices.delete(product.id); this.loadingPrices.delete(product.id);
} }