Skip to content

don't store empty content values if element is new for site#16818

Merged
brandonkelly merged 4 commits into5.xfrom
bugfix/16797-saving-content-and-relation-fields
Mar 4, 2025
Merged

don't store empty content values if element is new for site#16818
brandonkelly merged 4 commits into5.xfrom
bugfix/16797-saving-content-and-relation-fields

Conversation

@i-just
Copy link
Copy Markdown
Contributor

@i-just i-just commented Mar 3, 2025

Description

This PR ensured that when the element we’re saving is new for the site, we store all the default content. However, if the serialised value is empty and the element is new for a site, the empty value shouldn’t be saved.

steps to reproduce:

  1. clean install of at least 5.4.4
  2. create a local filesystem
  3. create a volume using that filesystem
  4. create an assets field
  5. create 2 entry types, each with a title and that assets field, leave all as default, and make the assets field mandatory for both entry types
  6. create a section with both entry types
  7. upload one image to assets
  8. create an entry in that section, switch entry type, select the asset from the previous step and attempt to save
  9. if you see a validation error and the assets field is empty - replication is done;
  10. if all saves as expected, then edit the section from step 6, switch the order of the entry types and save
  11. create a new entry as per step 8 - you should see the validation error for the assets field, and that field should be empty

Thanks, @olivierbon, for lots of extra info that helped get to the bottom of this issue!

Related issues

#16797

@i-just i-just requested a review from brandonkelly March 3, 2025 17:48
@brandonkelly brandonkelly merged commit c7b3550 into 5.x Mar 4, 2025
@brandonkelly brandonkelly deleted the bugfix/16797-saving-content-and-relation-fields branch March 4, 2025 22:24
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.

2 participants