Handling null properties values
jeanmw opened this issue · 0 comments
jeanmw commented
case "video":
var value = block.value;
return /*#__PURE__*/createElement("figure", {
className: "notion-asset-wrapper",
style: value.format !== undefined ? {
width: value.format.block_width
} : undefined
}, /*#__PURE__*/createElement(Asset, {
block: block,
mapImageUrl: mapImageUrl
}), value.properties.caption && /*#__PURE__*/createElement("figcaption", {
className: "notion-image-caption"
}, renderChildText(value.properties.caption)));
This generated block in react-notion.esm.js is failing when properties are null. Properties are not always present in this case and therefore there can be a failure here with .caption
in the chain. I'm not sure the best way to handle this - is the onus on the notion doc creator to ensure no null properties values? (this could happen if an unfinished video component was inserted in a doc and mistakenly forgotten about).
Should properties be required on ContentValueType
? on All values?
Should properties be required? Can we make them nullable, or is that an antipattern?