Closed
Description
I am having a very strange issue with StoreRouterConnectingModule that is breaking my app.
To summarize the issue, whenever I import "StoreRouterConnectingModule" to start using @ngrx/router-store, it breaks my app giving me an error that says
"TypeError: Cannot assign to read only property 'microTask' of object '[object Object]'"
Here is what my code looks like.
export interface AppState {
routes: fromRouter.RouterReducerState;
layout: fromLayout.AppLayoutModel;
player: fromPlayer.AppPlayerModel;
search: fromSearch.YtSearchModel;
}
export const reducers: ActionReducerMap<AppState> = {
routes: fromRouter.routerReducer,
layout: fromLayout.layoutReducer,
player: fromPlayer.playerReducer,
search: fromSearch.ytSearchReducer
};
export const metaReducers: ActionReducer<any, any>[] = !environment.production
? [storeFreeze]
: [];
these reducers are then imported in a module file like this.
const routes: Routes = [
{
path: '',
children: [
{
path: 'explore',
loadChildren: '../../explore/explore.module#ExploreModule'
}
]
},
{
path: '**',
redirectTo: '',
pathMatch: 'full'
}
];
@NgModule({
imports: [
RouterModule.forRoot(routes)
],
exports: [
RouterModule
]
})
export class CoreRoutes {}
I put the routes in a separate module named "CoreRoutes", which is imported in the coremodule below.
@NgModule({
declarations: [
CoreContainerComponent,
...CoreComponents
],
imports: [
CommonModule,
FormsModule,
StoreModule.forRoot(reducers, {
metaReducers
}),
CoreRoutes,
StoreRouterConnectingModule,
EffectsModule.forRoot([
SearchEffects
]),
!environment.production ? StoreDevtoolsModule.instrument() : [],
ClarityModule.forChild(),
SharedModule
],
exports: [
CoreContainerComponent
],
providers: [
YtPlayerService,
YtDataService
]
})
export class CoreModule {}
This 'core-module' is then imported into app.module.ts
As soon as I remove StoreRouterConnectingModule, everything works except for router-store, of course.
I am completely lost as to what it is that is causing the error.
Metadata
Metadata
Assignees
Labels
No labels