From b818bad3deb7ca776ec4dc6f1c9bb956d1df58db Mon Sep 17 00:00:00 2001 From: Haroen Viaene Date: Thu, 16 May 2019 11:29:35 +0200 Subject: [PATCH] refactor(lodash): remove difference (#2455) Both are arrays & always defined, so it's really enough to find all props in this._props (prevProps), but not in `props` --- .../src/connectors/connectConfigure.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/react-instantsearch-core/src/connectors/connectConfigure.js b/packages/react-instantsearch-core/src/connectors/connectConfigure.js index 928353fd91..765bbb64c1 100644 --- a/packages/react-instantsearch-core/src/connectors/connectConfigure.js +++ b/packages/react-instantsearch-core/src/connectors/connectConfigure.js @@ -1,4 +1,4 @@ -import { omit, difference } from 'lodash'; +import { omit } from 'lodash'; import createConnector from '../core/createConnector'; import { refineValue, @@ -22,8 +22,9 @@ export default createConnector({ transitionState(props, prevSearchState, nextSearchState) { const id = getId(); const { children, contextValue, indexContextValue, ...items } = props; + const propKeys = Object.keys(props); const nonPresentKeys = this._props - ? difference(Object.keys(this._props), Object.keys(props)) + ? Object.keys(this._props).filter(prop => propKeys.indexOf(prop) === -1) : []; this._props = props; const nextValue = {