diff --git a/CHANGELOG.md b/CHANGELOG.md index f468f685..e81fe566 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Fixed a PHP error that could occur when you map an entry field with a default value and there is an empty value in the feed. ([#1250](https://github.com/craftcms/feed-me/pull/1250)) - Fixed a bug where the `maxRelations` setting was not being respected for relational fields. ([#1354](https://github.com/craftcms/feed-me/issues/1354)) - Fixed a bug where importing assets with “Use existing assets” could create duplicate assets. ([#1348](https://github.com/craftcms/feed-me/issues/1348)) +- Fixed a bug where importing Address data from the Google Maps plugin could cause duplicate Addresses if the Address already existed. ([#1370](https://github.com/craftcms/feed-me/pull/1370)) ## 5.2.0 - 2023-07-06 diff --git a/src/helpers/DataHelper.php b/src/helpers/DataHelper.php index 7cbe2b79..bae2199b 100644 --- a/src/helpers/DataHelper.php +++ b/src/helpers/DataHelper.php @@ -279,6 +279,12 @@ public static function compareElementContent($content, $element): ?bool $newValue = null; } + // If array key & values are already within the existing array + if (is_array($newValue) && is_array($existingValue) && Hash::contains($existingValue,$newValue)) { + unset($trackedChanges[$key]); + continue; + } + // Check for simple fields first if (self::_compareSimpleValues($fields, $key, $existingValue, $newValue)) { unset($trackedChanges[$key]);