From 7fab23d22b25d5fae383b8d8cebf90f0b59c4fc0 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Wed, 3 Dec 2025 16:03:06 +0100 Subject: [PATCH] Refactor betterPricesMap handling in RevenueSection for Vue 3 compatibility - Removed the use of $set for updating betterPricesMap, leveraging direct assignment instead, which is now the standard in Vue 3. - Simplified the getBetterPrices method by eliminating unnecessary logging, enhancing code clarity while maintaining functionality. - These changes aim to improve performance and align with Vue 3 best practices for state management. --- frontend/src/components/falukant/RevenueSection.vue | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/falukant/RevenueSection.vue b/frontend/src/components/falukant/RevenueSection.vue index 5050fd5..6ef99a2 100644 --- a/frontend/src/components/falukant/RevenueSection.vue +++ b/frontend/src/components/falukant/RevenueSection.vue @@ -130,22 +130,19 @@ currentRegionId: this.currentRegionId } }); - console.log(`[RevenueSection] Product ${product.id} (${product.labelTr}): received ${data?.length || 0} better prices:`, data); // Speichere betterPrices in einem separaten Map, nicht auf dem product Objekt - this.$set(this.betterPricesMap, product.id, data || []); - console.log(`[RevenueSection] betterPricesMap after update:`, JSON.parse(JSON.stringify(this.betterPricesMap))); + // In Vue 3 ist $set nicht mehr nötig, direkte Zuweisung funktioniert + this.betterPricesMap[product.id] = data || []; } catch (error) { console.error(`Error loading prices for product ${product.id}:`, error); - this.$set(this.betterPricesMap, product.id, []); + this.betterPricesMap[product.id] = []; } finally { this.loadingPrices.delete(product.id); } } }, getBetterPrices(productId) { - const prices = this.betterPricesMap[productId] || []; - console.log(`[RevenueSection] getBetterPrices(${productId}): returning`, prices); - return prices; + return this.betterPricesMap[productId] || []; }, getCityPriceClass(branchType) { if (branchType === 'store') return 'city-price-green';