@@ -9,7 +9,7 @@ function getDisplayName(WrappedComponent) {
99}
1010
1111const defaultMapStateToProps = ( ) => ( { } ) ;
12- export default function connect ( mapStateToProps , injectExtraPropsKey ) {
12+ export default function connect ( mapStateToProps ) {
1313 const shouldSubscribe = ! ! mapStateToProps ;
1414 const finalMapStateToProps = mapStateToProps || defaultMapStateToProps ;
1515 return function wrapWithConnect ( WrappedComponent ) {
@@ -25,43 +25,18 @@ export default function connect(mapStateToProps, injectExtraPropsKey) {
2525 props,
2626 inject : {
2727 storeContext : { default : ( ) => ( { } ) } ,
28- ...( injectExtraPropsKey
29- ? {
30- injectExtraContext : {
31- from : injectExtraPropsKey ,
32- default : ( ) => ( { } ) ,
33- } ,
34- }
35- : { } ) ,
36- } ,
37- computed : {
38- injectExtraProps ( ) {
39- return this . injectExtraContext ? this . injectExtraContext . $attrs : { } ;
40- } ,
41- injectExtraListeners ( ) {
42- return this . injectExtraContext ? this . injectExtraContext . $listeners : { } ;
43- } ,
4428 } ,
4529 data ( ) {
4630 this . store = this . storeContext . store ;
47- this . preProps = {
48- ...omit ( getOptionProps ( this ) , [ '__propsSymbol__' ] ) ,
49- ...this . injectExtraProps ,
50- } ;
31+ this . preProps = omit ( getOptionProps ( this ) , [ '__propsSymbol__' ] ) ;
5132 return {
52- subscribed : finalMapStateToProps ( this . store . getState ( ) , {
53- ...this . $props ,
54- ...this . injectExtraProps ,
55- } ) ,
33+ subscribed : finalMapStateToProps ( this . store . getState ( ) , this . $props ) ,
5634 } ;
5735 } ,
5836 watch : {
5937 __propsSymbol__ ( ) {
6038 if ( mapStateToProps && mapStateToProps . length === 2 ) {
61- this . subscribed = finalMapStateToProps ( this . store . getState ( ) , {
62- ...this . $props ,
63- ...this . injectExtraProps ,
64- } ) ;
39+ this . subscribed = finalMapStateToProps ( this . store . getState ( ) , this . $props ) ;
6540 }
6641 } ,
6742 } ,
@@ -77,10 +52,7 @@ export default function connect(mapStateToProps, injectExtraPropsKey) {
7752 if ( ! this . unsubscribe ) {
7853 return ;
7954 }
80- const props = {
81- ...omit ( getOptionProps ( this ) , [ '__propsSymbol__' ] ) ,
82- ...this . injectExtraProps ,
83- } ;
55+ const props = omit ( getOptionProps ( this ) , [ '__propsSymbol__' ] ) ;
8456 const nextSubscribed = finalMapStateToProps ( this . store . getState ( ) , props ) ;
8557 if (
8658 ! shallowEqual ( this . preProps , props ) ||
@@ -109,15 +81,15 @@ export default function connect(mapStateToProps, injectExtraPropsKey) {
10981 } ,
11082 render ( ) {
11183 const { $slots = { } , $scopedSlots, subscribed, store } = this ;
112- const props = { ... getOptionProps ( this ) , ... this . injectExtraProps } ;
84+ const props = getOptionProps ( this ) ;
11385 this . preProps = { ...omit ( props , [ '__propsSymbol__' ] ) } ;
11486 const wrapProps = {
11587 props : {
11688 ...props ,
11789 ...subscribed ,
11890 store,
11991 } ,
120- on : { ... getListeners ( this ) , ... this . injectExtraListeners } ,
92+ on : getListeners ( this ) ,
12193 scopedSlots : $scopedSlots ,
12294 } ;
12395 return (
0 commit comments