Optimize catalog loading: backend bounds filtering + early returns
All checks were successful
Build Docker Image / build (push) Successful in 4m12s

- Add bounds (west/south/east/north) parameters to GetNodes query
- Add setBoundsFilter to useCatalogHubs, useCatalogSuppliers, useCatalogProducts
- Replace client-side bounds filtering with backend query
- Add early return to setProductFilter to avoid redundant fetches
- Watch filterByBounds to trigger backend refetch when checkbox changes
This commit is contained in:
Ruslan Bakiev
2026-01-24 12:19:00 +07:00
parent 8c753edb28
commit 9b99d8981c
6 changed files with 97 additions and 40 deletions

View File

@@ -99,6 +99,13 @@ export function useCatalogProducts() {
}
}
// Products don't have coordinates directly (they're an aggregation of offers)
// Bounds filtering would require a new backend query that filters by offer locations
// For now, this is a no-op - products show all regardless of map bounds
const setBoundsFilter = (_bounds: { west: number; south: number; east: number; north: number } | null) => {
// No-op: products are not filterable by map bounds in current implementation
}
return {
items,
isLoading,
@@ -110,6 +117,7 @@ export function useCatalogProducts() {
init,
setSupplierFilter,
setHubFilter,
clearFilters
clearFilters,
setBoundsFilter
}
}