Platform: Error with EffectsModule Angular 6.1.2

Created on 10 Aug 2018  路  5Comments  路  Source: ngrx/platform

Minimal reproduction of the bug/regression with instructions:


Hi!, when I try to use EffectsModule while compiling Angular CLI I get the following error: ERROR in params.map is not a function, what can it be? Thank you!

[users.module.ts]

@NgModule({
  imports: [
    CommonModule,
    ReactiveFormsModule,
    TableModule,
    DialogModule,
    InputTextModule,
    AutoCompleteModule,
    ButtonModule,
    KeyFilterModule,
    CalendarModule,
    InputSwitchModule,
    UsersRoutingModule,
    StoreModule.forFeature('users', users.reducers, {metaReducers: users.metaReducers}),
    EffectsModule.forFeature(users.effects),
  ],
  declarations: [UsersComponent]
})

[app.module.ts]

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    HttpClientModule,
    BrowserAnimationsModule,
    StoreModule.forRoot(reducers, {metaReducers}),
    EffectsModule.forRoot(effects),
    ApolloModule,
    HttpLinkModule,
    StoreDevtoolsModule.instrument({
      logOnly: environment.production
    }),
    LoginModule,
    Page404Module,
    RootModule,
    AppRoutingModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})

Versions of NgRx, Angular, Node, affected browser(s) and operating system(s):

NgRx: 6.1.0
Angular: 6.1.2
Node: 8.11.2
Browsers: Firefox, Chrome
OS: Windows 10

Needs Reproduction Effects bug

Most helpful comment

We have a StackBlitz seed which you can use.

All 5 comments

The effects you're passing through the EffectsModule.forRoot and EffectsModule.forFeature functions must be an array.
I can't tell for sure if this is the case in your example, can you give it a look?

yes, both are Arrays, this is the error image:

imagen

But when I comment EffectsModule in both modules the error goes away, what can it be?

PD: The app.module array is empty, the other is not.

Can you provide a reproduction? I don't see any problems with this at this point.

We have a StackBlitz seed which you can use.

I think it's an error of Angular CLI, when I put the import like this:

import effects from 'src/app/redux/db/mysql/users/users.effects

it works, when I put it with an intermediary:

import * as users from 'src/app/redux/db/mysql/users';

it does not work, but in both cases it prints the same array, I do not understand what happens but it seems that it is not a problem of EffectsModule, sorry for the inconvenience! and thank you!

Was this page helpful?
0 / 5 - 0 ratings