Skip to content

Commit 4350fac

Browse files
committed
Fixed location filter affecting unrelated queries
Fixes #405
1 parent 227061f commit 4350fac

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 5.0.3 - 2024-09-16
2+
### Fixed
3+
- Fixed location filter affecting unrelated queries (Fixes #405)
4+
15
## 5.0.2 - 2024-09-10
26
### Fixed
37
- Fixes location search (Fixes #394, #393, #392)

src/fields/MapField.php

+3
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,9 @@ public function afterPrepareElementQuery (CancelableEvent $event): void
436436
self::$searchParams['value'],
437437
self::$searchParams['field'],
438438
);
439+
440+
// Clear search params to prevent it being applied to unrelated queries.
441+
self::$searchParams = null;
439442
}
440443

441444
// Helpers

src/services/MapService.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public function modifyElementsQuery (ElementQueryInterface $query, mixed $value,
193193
'[[' . $alias . '.fieldId]] = ' . $field->id,
194194
];
195195

196-
$query->subQuery->join('JOIN', $table . ' ' . $alias, $on);
196+
$query->subQuery->join('LEFT JOIN', $table . ' ' . $alias, $on);
197197

198198
if ($value === ':empty:')
199199
{

0 commit comments

Comments
 (0)