@@ -2,7 +2,7 @@ import * as React from 'react';
22import { PropTypes } from 'prop-types' ;
33import initHistory , { Traveler } from './history' ;
44import { Plan , Actions , Connect , ConnectProps , EngineSubject , Update , ConnectClass } from './interfaces'
5- import { from , Stream , Subscription } from 'most' ;
5+ import { from , Stream , Subscription , mergeArray } from 'most' ;
66import { Engine } from './engine/most' ;
77
88// unfortunately React doesn't support symbol as context key yet, so let me just preteding using Symbol until react implement the Symbol version of Object.assign
@@ -24,10 +24,9 @@ export function connect<I, S>(main: Plan<I, S>, opts = { history: false }): (Wra
2424 static displayName = connectDisplayName
2525 constructor ( props , context ) {
2626 super ( props , context ) ;
27- let { actions, update$ } = main ( context [ REACT_MOST_ENGINE ] . historyStream , props )
28- let { actions : preActions , update$ : preUpdates } = this . main ( context [ REACT_MOST_ENGINE ] . historyStream , props )
29- this . update$ = preUpdates ? update$ . merge ( preUpdates ) : update$
30- this . actions = Object . assign ( { } , bindActions ( actions , context [ REACT_MOST_ENGINE ] . intentStream , this ) , preActions ) ;
27+ let { actions, update$ } = main ( context [ REACT_MOST_ENGINE ] . intentStream , props )
28+ this . update$ = this . update$ . merge ( update$ )
29+ this . actions = Object . assign ( { } , bindActions ( actions , context [ REACT_MOST_ENGINE ] . intentStream , this ) , this . actions ) ;
3130 }
3231 }
3332 } else {
@@ -48,10 +47,9 @@ export function connect<I, S>(main: Plan<I, S>, opts = { history: false }): (Wra
4847 return this . setState ( state ) ;
4948 } ) ;
5049 }
51- this . main = main
52- let { actions, update$ } = main ( context [ REACT_MOST_ENGINE ] . intentStream , props )
53- this . update$ = props . update$ ? props . update$ . merge ( update$ ) : update$
54- this . actions = Object . assign ( { } , bindActions ( actions , context [ REACT_MOST_ENGINE ] . intentStream , this ) , props . actions ) ;
50+ let { actions, update$ } = main ( engine . intentStream , props )
51+ this . actions = bindActions ( actions , engine . intentStream , this )
52+ this . update$ = update$
5553 let defaultKey = Object . keys ( WrappedComponent . defaultProps ) ;
5654 this . state = Object . assign (
5755 { } ,
0 commit comments