Skip to content

Commit

Permalink
replace filter with lodash/difference
Browse files Browse the repository at this point in the history
  • Loading branch information
fargito committed May 20, 2019
1 parent 86e7bfa commit 209ac6a
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import debounce from 'lodash/debounce';
import compose from 'recompose/compose';
import { createSelector } from 'reselect';
import isEqual from 'lodash/isEqual';
import difference from 'lodash/difference'
import { WrappedFieldInputProps } from 'redux-form';

import {
Expand Down Expand Up @@ -233,7 +234,7 @@ export class UnconnectedReferenceArrayInputController extends Component<
'The value of ReferenceArrayInput should be an array'
);
}
const idsToFetch = isInitialCall ? ids : ids.filter(id => !this.props.input.value.includes(id))
const idsToFetch = isInitialCall ? ids : difference(ids, this.props.input.value)
crudGetMany(reference, idsToFetch);
}
};
Expand Down

0 comments on commit 209ac6a

Please sign in to comment.