diff --git a/src/components/connect.js b/src/components/connect.js index 3b60ebbce..379cd1fae 100644 --- a/src/components/connect.js +++ b/src/components/connect.js @@ -321,7 +321,7 @@ export default function connect(mapStateToProps, mapDispatchToProps, mergeProps, haveMergedPropsChanged = false } - if (!haveMergedPropsChanged && renderedElement) { + if (pure && !haveMergedPropsChanged && renderedElement) { return renderedElement } diff --git a/test/components/connect.spec.js b/test/components/connect.spec.js index 514eea018..534ffedee 100644 --- a/test/components/connect.spec.js +++ b/test/components/connect.spec.js @@ -1868,5 +1868,28 @@ describe('React', () => { ReactDOM.unmountComponentAtNode(div) }) + + it('should update impure components whenever the state of the store changes', () => { + const store = createStore(() => ({})) + let renderCount = 0 + + @connect(() => ({}), null, null, { pure: false }) + class ImpureComponent extends React.Component { + render() { + ++renderCount + return
+ } + } + + TestUtils.renderIntoDocument( +