diff --git a/packages/react-instantsearch-core/src/core/__tests__/translatable.js b/packages/react-instantsearch-core/src/core/__tests__/translatable.js index ac9097d3ba..00b35411c5 100644 --- a/packages/react-instantsearch-core/src/core/__tests__/translatable.js +++ b/packages/react-instantsearch-core/src/core/__tests__/translatable.js @@ -25,9 +25,11 @@ describe('translatable', () => { const defaultTranslations = { sup: 'hey', thing: n => `${n} things`, + fallbackThing: 'hi', }; const translations = { sup: 'hoy', + fallbackThing: undefined, }; const Translated = translatable(defaultTranslations)(Dummy); const { translate } = shallow() @@ -35,5 +37,6 @@ describe('translatable', () => { .props(); expect(translate('sup')).toBe('hoy'); expect(translate('thing', 20)).toBe('20 things'); + expect(translate('fallbackThing')).toBe(undefined); }); }); diff --git a/packages/react-instantsearch-core/src/core/translatable.js b/packages/react-instantsearch-core/src/core/translatable.js index 9a9dfe105d..2ea8604ef8 100644 --- a/packages/react-instantsearch-core/src/core/translatable.js +++ b/packages/react-instantsearch-core/src/core/translatable.js @@ -1,5 +1,4 @@ import React, { Component } from 'react'; -import { has } from 'lodash'; const withKeysPropType = keys => (props, propName, componentName) => { const prop = props[propName]; @@ -23,7 +22,7 @@ export default function translatable(defaultTranslations) { const { translations } = this.props; const translation = - translations && has(translations, key) + translations && translations.hasOwnProperty(key) ? translations[key] : defaultTranslations[key]; diff --git a/packages/react-instantsearch-dom/src/components/LinkList.js b/packages/react-instantsearch-dom/src/components/LinkList.js index c5b4d23f34..c143810b54 100644 --- a/packages/react-instantsearch-dom/src/components/LinkList.js +++ b/packages/react-instantsearch-dom/src/components/LinkList.js @@ -1,4 +1,3 @@ -import { has } from 'lodash'; import React, { Component } from 'react'; import PropTypes from 'prop-types'; import Link from './Link'; @@ -35,7 +34,7 @@ export default class LinkList extends Component {