Fix type safety in catalog composables + 3 InfoPanel bugs
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:
Ruslan Bakiev
2026-01-26 23:30:16 +07:00
parent 839ab4e830
commit 70c53da8eb
7 changed files with 190 additions and 84 deletions

View File

@@ -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