[6.x] Fix default values and fieldtype meta after saving entries and terms - #15427
Open
duncanmcclean wants to merge 6 commits into
Open
[6.x] Fix default values and fieldtype meta after saving entries and terms#15427duncanmcclean wants to merge 6 commits into
duncanmcclean wants to merge 6 commits into
Conversation
the file writer drops empty values from root entries and default-locale terms, but the in-memory object keeps them, so `Field::preProcess()` never fell back to the default until the stache was cleared. mirror the writer's rule when extracting publish form values. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EmQ7DBwRHtNLUej3bbyMQW
return `meta` from the entry and term update endpoints and apply it in the save pipeline alongside the values, so relationship items added during `EntrySaving`/`TermSaving` render correctly. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EmQ7DBwRHtNLUej3bbyMQW
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EmQ7DBwRHtNLUej3bbyMQW
jasonvarga
previously requested changes
Sep 8, 2026
jasonvarga
left a comment
Member
There was a problem hiding this comment.
The PHP half looks right to me — ExtractsFromEntryFields and ExtractsFromTermFields mirror Entry::fileData()'s isRoot() conditional and Term::fileData()'s default-locale-only stripping precisely. I also confirmed the term restructure doesn't lose in-memory TermSaving changes, since LocalizedTerm::data() and inDefaultLocale()->data() both read through to the same underlying Term.
One issue on the JS side that needs fixing before this goes in — the wholesale setMeta() clobbers client-owned slug meta. Details inline.
Non-blocking: both new PHP tests only cover the root/default-locale branch, so nothing exercises the localization side of the new isRoot() ternary.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YNCvgvTMeBuxi35uWUEf1p
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YNCvgvTMeBuxi35uWUEf1p
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YNCvgvTMeBuxi35uWUEf1p
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request fixes two issues with the publish form after saving an entry or term and continuing to edit.
Firstly, it fixes an issue where default values weren't applied to fields that had been saved empty (for example, a grid hidden behind a toggle with
always_save: false), until the Stache was cleared.This was happening because
Entry::fileData()andTerm::fileData()strip null and empty values before writing to disk, but the in-memory object (which is what the save response is built from, and what the Stache caches) keeps them. A hidden grid is processed to[], which isn't null, soField::preProcess()never fell back to the field's default.This PR fixes it by mirroring the writer's rule when extracting publish form values: empty values are dropped for root entries and default-locale terms. Localizations are left alone since explicit nulls are meaningful there.
Secondly, it fixes an issue where relationship values set in an
EntrySavingorTermSavinglistener rendered as broken items after "Save & continue editing", until the page was reloaded.This was happening because the save pipeline re-applied the response's
values, but nothing refreshed the fieldtypemeta, so the Relationship fieldtype had no item data for the newly added IDs.This PR fixes it by returning
metafrom the entry and term update endpoints and applying it in the save pipeline alongside the values.The same missing
metawas also behind #15418: a conditionally hidden nested Replicator withdefault:rows gets fresh row IDs on every request, so after saving, the Assets fieldtypes inside those rows couldn't find their meta and threw, leaving the Control Panel unresponsive until a hard refresh.Fixes #11355
Fixes #11396
Fixes #15418
Fixes #15428
Replaces #11356