Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Conditional group defaultValues being saved to document object even if condition isn't true.

default discord avatar
_itsjustchris2 years ago
2

I have a few groups in a collection that appear conditionally based on checkboxes, and within those groups, I have some text fields with default values. I expected to see either no group saved to the document or, at most, an empty group object if the condition wasn't met when I added a new document to the collection.



Even though conditionally, the groups are not active when I save a document, is it expected behaviour for the group & default values to be saved on the document object?

  • discord user avatar
    denolfe
    2 years ago

    Yes, this is expected behavior because conditional logic is for representation in the admin interface only. It does not affect or alter data in any way - so default values behave normally.

  • default discord avatar
    _itsjustchris2 years ago

    I understand, thank you for clarifying.

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.