reactjs - Redux-observable combineepics not mapping -


i new redux-observables , attempting combine epics, not working believe should. below code makes "menu_toggle" toggle correctly , delay prior console logging out button has been pressed, login_request won't mapto login_success. have following example:

import { combineepics } 'redux-observable'; import 'rxjs';  const loginrequest = action$ =>     action$.oftype('login_request')       .delay(1000)       .mapto({ type: 'login_success' });  const menutoggle = action$ =>     action$.oftype('menu_toggle')       .delay(1000)       .subscribe(action => {           console.log('button pressed!');       });  export const rootepic = combineepics(     loginrequest, menutoggle ); 

the above example, have actual code in separate files, not seem work. if alter to:

export const rootepic = combineepics(loginrequest); 

then fires correctly. add additional epic combineepics, won't fire epic longer.

i cannot seem figure out might making mistake. assistance extremely appreciated!

the problem menutoggle epic using subscribe, , subscribe finalize action stream, make other epics not being able listen on stream anymore. so, instead of using subscribe, use this:

const menutoggle = action$ =>   action$.oftype('menu_toggle')     .delay(1000)     .do(action => {       console.log('button pressed!');     })     .ignoreelements(); 

you may read issue know more how handle epic doesn't return action.


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -