fix: dispatch QUERY_FAILURE on query failure (#3243)

This commit is contained in:
stefanprobst 2020-02-13 10:48:02 +01:00 committed by GitHub
parent 7784e780b8
commit 2447f9c311
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -74,7 +74,7 @@ export function querySuccess(namespace, collection, searchFields, searchTerm, re
export function queryFailure(namespace, collection, searchFields, searchTerm, error) {
return {
type: QUERY_SUCCESS,
type: QUERY_FAILURE,
payload: {
namespace,
collection,

View File

@ -157,7 +157,10 @@ export default class RelationControl extends React.Component {
const searchFieldsArray = List.isList(searchFields) ? searchFields.toJS() : [searchFields];
query(forID, collection, searchFieldsArray, term).then(({ payload }) => {
let options = this.parseHitOptions(payload.response.hits);
let options =
payload.response && payload.response.hits
? this.parseHitOptions(payload.response.hits)
: [];
if (!this.allOptions && !term) {
this.allOptions = options;