From e9115dab4c225c5f459930a5f4b06e761b7012db Mon Sep 17 00:00:00 2001 From: Deluan Date: Fri, 5 Jun 2020 11:45:46 -0400 Subject: [PATCH] Allow Writable to have multiple children --- ui/src/common/Writable.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/src/common/Writable.js b/ui/src/common/Writable.js index f0885d7b7..8655a85da 100644 --- a/ui/src/common/Writable.js +++ b/ui/src/common/Writable.js @@ -1,4 +1,4 @@ -import { cloneElement } from 'react' +import { cloneElement, Children, isValidElement } from 'react' export const isWritable = (owner) => { return ( @@ -14,7 +14,9 @@ export const isReadOnly = (owner) => { const Writable = (props) => { const { record, children } = props if (isWritable(record.owner)) { - return cloneElement(children, props) + return Children.map(children, (child) => + isValidElement(child) ? cloneElement(child, props) : child + ) } return null }