state$.do() is not defined.
Hi and thanks for this really usefull lib !
I have a little problem with ngrx-store-router. I'm working on a project using Angular2, TS and SystemJS. Here is how a use your connector :
import { routerReducer, routerMiddleware } from 'ngrx-store-router';
const reducers = ModuleLoader.mergeReducers({ env, router: routerReducer });
const baseState = ModuleLoader.buildInitialState(initialState);
bootstrap(MainComponent, [
ROUTER_PROVIDERS,
provideStore(reducers, baseState),
instrumentStore(),
routerMiddleware
]).catch(console.error);
ModuleLoader.mergeReducers is a function that I wrote. It performs annoying stuff, reducers is an object like this one :
{
env: function(state, _a),
router: function(state, action),
// ... other things that works well
}
I don't know why but an error is throwed when my app starts (and crashes) :
EXCEPTION: Error during instantiation of Store! (MainComponent -> Store).
Uncaught (in promise): EXCEPTION: Error during instantiation of Store! (MainComponent -> Store). ORIGINAL EXCEPTION: TypeError: state$.do is not a function
I've console.loged state$ and it's a function.
Any idea ?
My guess is that what you're doing with your merge reducers is doing something with the state before it reaches the middleware. Are you modifying the router reducer there?
No I'm not. ModuleLoader do some basics things : I can register modules with reducers and mergeReducers merge reducers from modules and those passed as argument.
I wrote this code 2 months ago and I can't check what I'm saying right now but I'm prety sure that ModuleLoader.mergeReducers() doesn't do anything else.
Seems like the operators aren't being applied before use. What version of rxjs do you have installed?
I'm using version 5.0.0-beta.2
Okay so the issue solved. I don't really get why :
[shorter version]
First I've tried to update rxjs to beta.6. Doing this produced a lot of conflicts/bugs so I've decided to came back to beta.2, remove my node_modules, make a clean install and it works.
Maybe I had some residues. Anyway, thanks for your help :-).
Cool, glad you got it sorted out.