Skip to content

Commit

Permalink
Fixed location filter affecting unrelated queries
Browse files Browse the repository at this point in the history
Fixes #405
  • Loading branch information
Tam committed Sep 16, 2024
1 parent 227061f commit 4350fac
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 5.0.3 - 2024-09-16
### Fixed
- Fixed location filter affecting unrelated queries (Fixes #405)

## 5.0.2 - 2024-09-10
### Fixed
- Fixes location search (Fixes #394, #393, #392)
Expand Down
3 changes: 3 additions & 0 deletions src/fields/MapField.php
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,9 @@ public function afterPrepareElementQuery (CancelableEvent $event): void
self::$searchParams['value'],
self::$searchParams['field'],
);

// Clear search params to prevent it being applied to unrelated queries.
self::$searchParams = null;
}

// Helpers
Expand Down
2 changes: 1 addition & 1 deletion src/services/MapService.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public function modifyElementsQuery (ElementQueryInterface $query, mixed $value,
'[[' . $alias . '.fieldId]] = ' . $field->id,
];

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

if ($value === ':empty:')
{
Expand Down

0 comments on commit 4350fac

Please sign in to comment.