From 32f4f00ada8f806c3f7cbac6ab6d6f25f944f659 Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Thu, 7 Mar 2024 08:06:39 -0800 Subject: [PATCH] Only check $oldEntryIds / $newEntryIds once --- src/Field.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Field.php b/src/Field.php index c6e861f3..f6c0d3e5 100644 --- a/src/Field.php +++ b/src/Field.php @@ -273,6 +273,10 @@ private static function adjustFieldValues( array $newEntryIds, bool $propagate, ): void { + if (empty($oldEntryIds) || $oldEntryIds === $newEntryIds) { + return; + } + $resave = false; foreach (self::fieldInstances($owner, $field) as $fieldInstance) { @@ -280,7 +284,7 @@ private static function adjustFieldValues( $oldValue = $owner->getFieldValue($fieldInstance->handle); $oldValue = $oldValue?->getRawContent(); - if (!$oldValue || empty($oldEntryIds) || $oldEntryIds === $newEntryIds) { + if (!$oldValue) { continue; }