@@ -11,9 +11,6 @@ const defaultMergeProps = (stateProps, dispatchProps, parentProps) => ({
11
11
...stateProps ,
12
12
...dispatchProps
13
13
} ) ;
14
- const defaultOptions = {
15
- pure : true
16
- } ;
17
14
18
15
function getDisplayName ( Component ) {
19
16
return Component . displayName || Component . name || 'Component' ;
@@ -26,7 +23,7 @@ export default function createConnect(React) {
26
23
const { Component, PropTypes } = React ;
27
24
const storeShape = createStoreShape ( PropTypes ) ;
28
25
29
- return function connect ( mapStateToProps , mapDispatchToProps , mergeProps , options ) {
26
+ return function connect ( mapStateToProps , mapDispatchToProps , mergeProps , options = { } ) {
30
27
const shouldSubscribe = Boolean ( mapStateToProps ) ;
31
28
const finalMapStateToProps = mapStateToProps || defaultMapStateToProps ;
32
29
const finalMapDispatchToProps = isPlainObject ( mapDispatchToProps ) ?
@@ -35,7 +32,7 @@ export default function createConnect(React) {
35
32
const finalMergeProps = mergeProps || defaultMergeProps ;
36
33
const shouldUpdateStateProps = finalMapStateToProps . length > 1 ;
37
34
const shouldUpdateDispatchProps = finalMapDispatchToProps . length > 1 ;
38
- const finalOptions = { ... defaultOptions , ... options } || defaultOptions ;
35
+ const { pure = true } = options ;
39
36
40
37
// Helps track hot reloading.
41
38
const version = nextVersion ++ ;
@@ -92,7 +89,7 @@ export default function createConnect(React) {
92
89
} ;
93
90
94
91
shouldComponentUpdate ( nextProps , nextState ) {
95
- return ! finalOptions . pure || ! shallowEqual ( this . state . props , nextState . props ) ;
92
+ return ! pure || ! shallowEqual ( this . state . props , nextState . props ) ;
96
93
}
97
94
98
95
constructor ( props , context ) {
0 commit comments