Skip to content

Commit

Permalink
Only check $oldEntryIds / $newEntryIds once
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Mar 7, 2024
1 parent 46725fb commit 32f4f00
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,18 @@ private static function adjustFieldValues(
array $newEntryIds,
bool $propagate,
): void {
if (empty($oldEntryIds) || $oldEntryIds === $newEntryIds) {
return;
}

$resave = false;

foreach (self::fieldInstances($owner, $field) as $fieldInstance) {
/** @var HtmlFieldData|null $oldValue */
$oldValue = $owner->getFieldValue($fieldInstance->handle);
$oldValue = $oldValue?->getRawContent();

if (!$oldValue || empty($oldEntryIds) || $oldEntryIds === $newEntryIds) {
if (!$oldValue) {
continue;
}

Expand Down

0 comments on commit 32f4f00

Please sign in to comment.