FIX BUILD ERRORS & AVOID INFINITE RECURSION: Enhance product enrichment and type definitions in MerchantStore component

- Updated the product enrichment logic in MerchantStore.vue to ensure all necessary properties match the Product interface, improving data consistency.
- Added optional properties for active status, pending state, and configuration in the Product interface within market.ts, enhancing flexibility for merchant store management.
- Improved type assertions in MarketPage.vue and StallView.vue to ensure proper type handling for product data, enhancing type safety and clarity.

These changes improve the robustness and reliability of product data handling across the market components, enhancing the overall user experience.
This commit is contained in:
padreug 2025-09-26 17:20:59 +02:00
parent d98dcc58d7
commit 478b83ddd3
4 changed files with 35 additions and 16 deletions

View file

@ -138,7 +138,7 @@
<ProductCard
v-for="product in filteredProducts"
:key="product.id"
:product="product"
:product="product as Product"
@view-details="viewProductDetails"
@view-stall="viewStall"
/>
@ -159,9 +159,8 @@
import { ref, computed, onMounted, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { useMarketStore } from '@/modules/market/stores/market'
import { Card, CardContent } from '@/components/ui/card'
import { Card } from '@/components/ui/card'
import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
import { Badge } from '@/components/ui/badge'
import {
Select,
@ -184,6 +183,7 @@ const marketStore = useMarketStore()
// State
const isLoading = ref(false)
const searchResults = ref<Product[]>([])
const searchQuery = ref('')
const sortBy = ref('name')
const selectedCategories = ref<string[]>([])
const showProductDetail = ref(false)
@ -213,8 +213,8 @@ const searchOptions: FuzzySearchOptions<Product> = {
const stallId = computed(() => route.params.stallId as string)
// Get stall data
const stall = computed<Stall | undefined>(() => {
return marketStore.stalls.find(s => s.id === stallId.value)
const stall = computed(() => {
return marketStore.stalls.find(s => s.id === stallId.value) as Stall | undefined
})
// Get products for this stall
@ -284,11 +284,14 @@ const toggleCategoryFilter = (category: string) => {
const clearFilters = () => {
selectedCategories.value = []
searchResults.value = []
searchQuery.value = ''
}
// Handle fuzzy search results
const handleSearchResults = (results: Product[]) => {
searchResults.value = results
// Extract search query from fuzzy search component if needed
// For now, we'll track it separately
}
const viewProductDetails = (product: Product) => {