From e68c043d245643c5648fcfc40845f68cf6cc38d1 Mon Sep 17 00:00:00 2001 From: villo Date: Thu, 16 Jan 2020 20:26:55 -0300 Subject: [PATCH] fix(simple-form-iterator): Fixes object-object when there is a single TextInput without source param. #2489 --- packages/ra-ui-materialui/src/form/SimpleFormIterator.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/ra-ui-materialui/src/form/SimpleFormIterator.js b/packages/ra-ui-materialui/src/form/SimpleFormIterator.js index 53c3fe60ee7..5c73d09225e 100644 --- a/packages/ra-ui-materialui/src/form/SimpleFormIterator.js +++ b/packages/ra-ui-materialui/src/form/SimpleFormIterator.js @@ -103,9 +103,14 @@ export class SimpleFormIterator extends Component { }; addField = () => { - const { fields } = this.props; + const { fields, children } = this.props; this.ids.push(this.nextId++); - fields.push({}); + // Checks if there is just 1 children without source param then push string since it's not an {} + if (children.props && children.props.source === undefined) { + fields.push(''); + } else { + fields.push({}); + } }; render() {