fix: check if node.prop is defined

This commit is contained in:
Michael Maier
2021-11-28 15:35:56 +01:00
parent c2db1d4d44
commit 28bb07d415

View File

@@ -325,14 +325,16 @@ const rect = (parent, node) => {
.attr('width', totalWidth) .attr('width', totalWidth)
.attr('height', totalHeight); .attr('height', totalHeight);
const propKeys = new Set(Object.keys(node.props)); if (node.props) {
if (node.props?.borders) { const propKeys = new Set(Object.keys(node.props));
applyNodePropertyBorders(rect, node.props.borders, totalWidth, totalHeight); if (node.props.borders) {
propKeys.delete('borders'); applyNodePropertyBorders(rect, node.props.borders, totalWidth, totalHeight);
propKeys.delete('borders');
}
propKeys.forEach((propKey) => {
log.warn(`Unknown node property ${propKey}`);
});
} }
propKeys.forEach((propKey) => {
log.warn(`Unknown node property ${propKey}`);
});
updateNodeBounds(node, rect); updateNodeBounds(node, rect);