From 9fed79b8c3750e72a416d27e0aa60cf5e09ecc29 Mon Sep 17 00:00:00 2001 From: Keane Nguyen Date: Mon, 11 Mar 2019 10:23:05 -0500 Subject: [PATCH] fix(relation-widget): accept string in searchFields config (#2137) --- packages/netlify-cms-widget-relation/src/RelationControl.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/netlify-cms-widget-relation/src/RelationControl.js b/packages/netlify-cms-widget-relation/src/RelationControl.js index 1fe5a282..68348764 100644 --- a/packages/netlify-cms-widget-relation/src/RelationControl.js +++ b/packages/netlify-cms-widget-relation/src/RelationControl.js @@ -130,9 +130,10 @@ export default class RelationControl extends React.Component { loadOptions = debounce((term, callback) => { const { field, query, forID } = this.props; const collection = field.get('collection'); - const searchFields = field.get('searchFields').toJS(); + const searchFields = field.get('searchFields'); + const searchFieldsArray = List.isList(searchFields) ? searchFields.toJS() : [searchFields]; - query(forID, collection, searchFields, term).then(({ payload }) => { + query(forID, collection, searchFieldsArray, term).then(({ payload }) => { let options = this.parseHitOptions(payload.response.hits); if (!this.allOptions && !term) {