From 0577367d4f7173d71b141ff0490d80fa29274966 Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Mon, 26 Nov 2018 16:38:09 +0530 Subject: [PATCH] Fix default values in the campaign dropdown --- frontend/my/src/Campaign.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/frontend/my/src/Campaign.js b/frontend/my/src/Campaign.js index ef26125..12bc0ad 100644 --- a/frontend/my/src/Campaign.js +++ b/frontend/my/src/Campaign.js @@ -308,7 +308,10 @@ class TheFormDef extends React.PureComponent { })()} - {getFieldDecorator("lists", { initialValue: subLists, rules: [{ required: true }] })( + {getFieldDecorator("lists", { + initialValue: subLists.length > 0 ? subLists : (this.props.data[cs.ModelLists].length === 1 ? [this.props.data[cs.ModelLists][0].id] : undefined), + rules: [{ required: true }] + })( - {[...this.props.data[cs.ModelTemplates]].map((v, i) => + {this.props.data[cs.ModelTemplates].map((v, i) => { v["name"] } )}