From 6b3b30108bc4f6f23200f7a1ec90146f34d807f8 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Wed, 3 Dec 2025 16:15:01 +0100 Subject: [PATCH] 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. --- frontend/src/components/falukant/RevenueSection.vue | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/falukant/RevenueSection.vue b/frontend/src/components/falukant/RevenueSection.vue index 6ef99a2..d3fd377 100644 --- a/frontend/src/components/falukant/RevenueSection.vue +++ b/frontend/src/components/falukant/RevenueSection.vue @@ -131,11 +131,17 @@ } }); // Speichere betterPrices in einem separaten Map, nicht auf dem product Objekt - // In Vue 3 ist $set nicht mehr nötig, direkte Zuweisung funktioniert - this.betterPricesMap[product.id] = data || []; + // In Vue 3 müssen wir ein neues Objekt erstellen, um die Reaktivität zu triggern + this.betterPricesMap = { + ...this.betterPricesMap, + [product.id]: data || [] + }; } catch (error) { console.error(`Error loading prices for product ${product.id}:`, error); - this.betterPricesMap[product.id] = []; + this.betterPricesMap = { + ...this.betterPricesMap, + [product.id]: [] + }; } finally { this.loadingPrices.delete(product.id); }