diff --git a/frontend/src/components/falukant/RevenueSection.vue b/frontend/src/components/falukant/RevenueSection.vue index 2e98004..a09f197 100644 --- a/frontend/src/components/falukant/RevenueSection.vue +++ b/frontend/src/components/falukant/RevenueSection.vue @@ -78,17 +78,22 @@ }, watch: { isRevenueTableOpen(newVal) { - if (newVal) { + if (newVal && this.currentRegionId !== null) { this.loadPricesForAllProducts(); } }, products: { handler() { - if (this.isRevenueTableOpen) { + if (this.isRevenueTableOpen && this.currentRegionId !== null) { this.loadPricesForAllProducts(); } }, deep: true + }, + currentRegionId(newVal) { + if (this.isRevenueTableOpen && newVal !== null) { + this.loadPricesForAllProducts(); + } } }, methods: { @@ -99,6 +104,10 @@ } }, async loadPricesForAllProducts() { + if (this.currentRegionId === null || this.currentRegionId === undefined) { + console.log(`[RevenueSection] Skipping loadPricesForAllProducts - currentRegionId is null/undefined`); + return; + } console.log(`[RevenueSection] loadPricesForAllProducts called, products: ${this.products.length}, currentRegionId: ${this.currentRegionId}`); for (const product of this.products) { if (this.loadingPrices.has(product.id)) continue;