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

@@ -179,6 +179,17 @@ export function useCatalogProducts() {
// Products are filtered by offer locations within bounds
const setBoundsFilter = (bounds: { west: number; south: number; east: number; north: number } | null) => {
// Early return if bounds haven't changed
const prev = filterBounds.value
const same = prev === bounds || (
prev && bounds &&
prev.west === bounds.west &&
prev.south === bounds.south &&
prev.east === bounds.east &&
prev.north === bounds.north
)
if (same) return
filterBounds.value = bounds
if (isInitialized.value) {
fetchProducts()