Description
After upgrading from 2.0 to 2.1, unconfigured content properties no longer return null.
In 2.0, if an optional content property was not configured, it returned:
In 2.1, the same property now returns:
{
"__typename": "_Content"
}
This appears to be a behavior change/regression and breaks common null-check logic such as:
{content.video && (
<section>
<OptimizelyComponent content={content.video} />
</section>
)}
Since the returned object is truthy, the component is rendered even though the content property is effectively empty.
Steps to Reproduce
- Use SDK/API version 2.1.
- Define an optional content property, for example:
video: {
type: "content" as const,
displayName: "Video",
sortOrder: 55,
isLocalized: true,
allowedTypes: [EmbeddedVideoContentType],
},
- Create a page and leave the
video property unconfigured.
- Fetch/query the page.
- Inspect the value of
content.video.
Expected Behavior
An unconfigured optional content property should return:
This was the behavior in version 2.0.
Actual Behavior
The property returns:
{
"__typename": "_Content"
}
instead of null.
Impact
This is a breaking change for applications that rely on null checks to determine whether optional content exists. Existing conditional rendering logic now evaluates to true for unconfigured content properties, requiring additional checks for __typename or other workarounds.
Description
After upgrading from 2.0 to 2.1, unconfigured content properties no longer return
null.In 2.0, if an optional content property was not configured, it returned:
nullIn 2.1, the same property now returns:
{ "__typename": "_Content" }This appears to be a behavior change/regression and breaks common null-check logic such as:
Since the returned object is truthy, the component is rendered even though the content property is effectively empty.
Steps to Reproduce
videoproperty unconfigured.content.video.Expected Behavior
An unconfigured optional content property should return:
nullThis was the behavior in version 2.0.
Actual Behavior
The property returns:
{ "__typename": "_Content" }instead of
null.Impact
This is a breaking change for applications that rely on null checks to determine whether optional content exists. Existing conditional rendering logic now evaluates to
truefor unconfigured content properties, requiring additional checks for__typenameor other workarounds.