fix: dispatch QUERY_FAILURE on query failure (#3243)
This commit is contained in:
parent
7784e780b8
commit
2447f9c311
@ -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,
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user