fix(catalog): prevent unnecessary list reloads on map movement
All checks were successful
Build Docker Image / build (push) Successful in 4m14s
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:
@@ -101,6 +101,17 @@ export function useCatalogSuppliers() {
|
||||
}
|
||||
|
||||
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) {
|
||||
fetchPage(0, true)
|
||||
|
||||
Reference in New Issue
Block a user