Skip to content

Compare localized fields with the closest origin that carries the key - #617

Merged
ryanmitchell merged 1 commit into
statamic:5.xfrom
SUXUMI:fix/localized-fields-compare-direct-origin
Sep 14, 2026
Merged

ryanmitchell merged 1 commit into
statamic:5.xfrom
SUXUMI:fix/localized-fields-compare-direct-origin

Conversation

@SUXUMI

@SUXUMI SUXUMI commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Fixes #616

Entry::makeModelFromContract() compares local values with the root instead of the closest origin carrying the field. It checks __localized_fields in $fieldOrigin->data(), but fromModel() never adds that key, so the loop always reaches the root.

With three or more sites in an origin chain, this causes two errors:

  • A local value matching the root but differing from the inherited value is dropped.
  • A copy of the direct origin's value is marked as localized when the root differs, so it stops following its origin.

A null localized by the direct origin is also skipped.

The one-line fix uses ! $fieldOriginData->has($blueprintField) to stop at the closest origin carrying the field, including stored null, matching HasOrigin::value().

Two tests cover the dropped value and the unnecessary localization. Both fail on 5.x without the fix.

@ryanmitchell
ryanmitchell merged commit 9970ad7 into statamic:5.x Sep 14, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Localized values are compared with the root instead of the closest origin carrying the field

2 participants