In an effort to simplify frontend tasks and prevent confusion over types, we're introducing a change in the way we handle the return value of boolean fields in your records.
Basically, boolean fields will never return
null, and only
false. Where previously the APIs would return
null, they will always normalize the value to
Starting today, only newly created DatoCMS projects will follow the new convention.
Existing projects won't be affected in any way, as this new behavior could result in breaking changes. If you wish to apply the update on a existing project, you can do so from your project's settings.
You'll notice the change in two situations:
If there are already existing records in the model, and no default value is assigned when creating the field:
Previously: The field value would remain
nullfor each existing record.
Now: The field value will be
falsefor each existing record.
If you set the boolean field value to
Previously: Both CMA and CDA would return
Now: Both CMA and CDA will return
To activate the new functionality on existing projects, head over to the "Available Updates" section of their environment configuration, as shown in this video:
As with any update, we strongly recommend testing the effects in a sandbox environment before applying the change to your primary environment, as this update cannot be undone.