@@ -82,6 +82,7 @@ export default function connect(mapStateToProps, mapDispatchToProps, mergeProps,
82
82
if ( ! this . finalMapStateToProps ) {
83
83
return this . configureFinalMapState ( store , props )
84
84
}
85
+
85
86
const state = store . getState ( )
86
87
const stateProps = this . doStatePropsDependOnOwnProps ?
87
88
this . finalMapStateToProps ( state , props ) :
@@ -93,28 +94,38 @@ export default function connect(mapStateToProps, mapDispatchToProps, mergeProps,
93
94
configureFinalMapState ( store , props ) {
94
95
const mappedState = mapState ( store . getState ( ) , props )
95
96
const isFactory = typeof mappedState === 'function'
97
+
96
98
this . finalMapStateToProps = isFactory ? mappedState : mapState
97
99
this . doStatePropsDependOnOwnProps = this . finalMapStateToProps . length !== 1
98
- return isFactory ? this . computeStateProps ( store , props ) : checkStateShape ( mappedState )
100
+
101
+ return isFactory ?
102
+ this . computeStateProps ( store , props ) :
103
+ checkStateShape ( mappedState )
99
104
}
100
105
101
106
computeDispatchProps ( store , props ) {
102
107
if ( ! this . finalMapDispatchToProps ) {
103
108
return this . configureFinalMapDispatch ( store , props )
104
109
}
110
+
105
111
const { dispatch } = store
106
112
const dispatchProps = this . doDispatchPropsDependOnOwnProps ?
107
113
this . finalMapDispatchToProps ( dispatch , props ) :
108
114
this . finalMapDispatchToProps ( dispatch )
115
+
109
116
return checkStateShape ( dispatchProps , true )
110
117
}
111
118
112
119
configureFinalMapDispatch ( store , props ) {
113
120
const mappedDispatch = mapDispatch ( store . dispatch , props )
114
121
const isFactory = typeof mappedDispatch === 'function'
122
+
115
123
this . finalMapDispatchToProps = isFactory ? mappedDispatch : mapDispatch
116
124
this . doDispatchPropsDependOnOwnProps = this . finalMapDispatchToProps . length !== 1
117
- return isFactory ? this . computeDispatchProps ( store , props ) : checkStateShape ( mappedDispatch , true )
125
+
126
+ return isFactory ?
127
+ this . computeDispatchProps ( store , props ) :
128
+ checkStateShape ( mappedDispatch , true )
118
129
}
119
130
120
131
updateStatePropsIfNeeded ( ) {
0 commit comments