Fix type safety in catalog composables + 3 InfoPanel bugs
All checks were successful
Build Docker Image / build (push) Successful in 3m42s
All checks were successful
Build Docker Image / build (push) Successful in 3m42s
- Add proper codegen types to all catalog composables: - useCatalogHubs: HubItem, NearestHubItem - useCatalogSuppliers: SupplierItem, NearestSupplierItem - useCatalogProducts: ProductItem - useCatalogOffers: OfferItem - useCatalogInfo: InfoEntity, ProductItem, HubItem, OfferItem - Fix InfoPanel bugs for offers: - Use locationLatitude/locationLongitude for offer coordinates - Enrich entity with supplierName after loading profile - Apply-to-filter now adds both product AND hub for offers - Filter null values from GraphQL array responses - Add type-safe coordinate helper (getEntityCoords) - Fix urlBounds type inference in useCatalogSearch
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import type { ProductsListQueryResult } from '~/composables/graphql/public/geo-generated'
|
||||
import {
|
||||
ProductsListDocument,
|
||||
GetNodeDocument,
|
||||
@@ -7,8 +8,11 @@ import {
|
||||
GetSupplierProfileDocument
|
||||
} from '~/composables/graphql/public/exchange-generated'
|
||||
|
||||
// Type from codegen
|
||||
type ProductItem = NonNullable<NonNullable<ProductsListQueryResult['productsList']>[number]>
|
||||
|
||||
// Shared state
|
||||
const items = ref<any[]>([])
|
||||
const items = ref<ProductItem[]>([])
|
||||
const isLoading = ref(false)
|
||||
const isLoadingMore = ref(false)
|
||||
const isInitialized = ref(false)
|
||||
@@ -130,7 +134,7 @@ export function useCatalogProducts() {
|
||||
'public',
|
||||
'geo'
|
||||
)
|
||||
items.value = data?.productsList || []
|
||||
items.value = (data?.productsList || []).filter((p): p is ProductItem => p !== null)
|
||||
}
|
||||
|
||||
isInitialized.value = true
|
||||
|
||||
Reference in New Issue
Block a user