fix: dispatch QUERY_FAILURE on query failure (#3243)
This commit is contained in:
@ -74,7 +74,7 @@ export function querySuccess(namespace, collection, searchFields, searchTerm, re
|
|||||||
|
|
||||||
export function queryFailure(namespace, collection, searchFields, searchTerm, error) {
|
export function queryFailure(namespace, collection, searchFields, searchTerm, error) {
|
||||||
return {
|
return {
|
||||||
type: QUERY_SUCCESS,
|
type: QUERY_FAILURE,
|
||||||
payload: {
|
payload: {
|
||||||
namespace,
|
namespace,
|
||||||
collection,
|
collection,
|
||||||
|
@ -157,7 +157,10 @@ export default class RelationControl extends React.Component {
|
|||||||
const searchFieldsArray = List.isList(searchFields) ? searchFields.toJS() : [searchFields];
|
const searchFieldsArray = List.isList(searchFields) ? searchFields.toJS() : [searchFields];
|
||||||
|
|
||||||
query(forID, collection, searchFieldsArray, term).then(({ payload }) => {
|
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) {
|
if (!this.allOptions && !term) {
|
||||||
this.allOptions = options;
|
this.allOptions = options;
|
||||||
|
Reference in New Issue
Block a user