fix(catalog): prevent unnecessary list reloads on map movement
All checks were successful
Build Docker Image / build (push) Successful in 4m14s

- Remove currentMapBounds from watch - it changes on every map move
- Watch only filterByBounds and urlBounds (URL-based state)
- Add early return in setBoundsFilter if bounds haven't changed

This fixes the issue where the list was reloading on every map movement
even when the 'filter by bounds' checkbox was OFF.
This commit is contained in:
Ruslan Bakiev
2026-01-26 22:24:47 +07:00
parent 6545eeabea
commit 19aca61845
6 changed files with 123 additions and 9 deletions

View File

@@ -237,11 +237,10 @@ watch(productId, (newProductId) => {
}, { immediate: true })
// Apply bounds filter when "filter by map bounds" is enabled
// Use URL bounds if available, otherwise use current map bounds
watch([filterByBounds, urlBounds, currentMapBounds], ([enabled, urlB, mapB]) => {
// Use URL bounds if available, otherwise current map bounds
const bounds = urlB || mapB
const boundsToApply = enabled && bounds ? bounds : null
// Only watch URL bounds - currentMapBounds changes too often (every map move)
watch([filterByBounds, urlBounds], ([enabled, urlB]) => {
// Apply bounds filter only when checkbox is ON and bounds are in URL
const boundsToApply = enabled && urlB ? urlB : null
setHubBoundsFilter(boundsToApply)
setSupplierBoundsFilter(boundsToApply)
setProductBoundsFilter(boundsToApply)