添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Which @ngrx/* package(s) are the source of the bug?

effects

Minimal reproduction of the bug/regression with instructions

I have a v.14 project and I just upgraded it to v.15. But I get this weird error now in runtime:

TypeError: Cannot read properties of undefined (reading 'pipe')
at navigateToRoot$.dispatch (global.effects.ts:15:31)
at createEffect (ngrx-effects.mjs:48:20)
at <instance_members_initializer> (global.effects.ts:13:34)
at new AppEffects (global.effects.ts:11:4)
at Object.AppEffects_Factory [as factory] (global.effects.ts:29:6)
at R3Injector.hydrate (core.mjs:8767:35)
at R3Injector.get (core.mjs:8655:33)
at injectInjectorOnly (core.mjs:738:33)
at ɵɵinject (core.mjs:742:60)
at inject (core.mjs:825:12)

The code is pretty simple and it's been working for ages:

@Injectable()
export class AppEffects {
   constructor(private readonly actions$: Actions, private readonly router: Router, private readonly errDlgSvc: IlgErrorDialogService) {}
   navigateToRoot$ = createEffect(
      () => {
         return this.actions$.pipe(
            ofType(GlobalActions.navigateToRoot),
            tap(() => this.router.navigate([""]))
      { dispatch: false }
   showError$ = createEffect(() => {
      return this.actions$.pipe(
         ofType(setError),
         map(({ errorObj }) => ({ message: errorObj.errorMsg, title: "Error" } as ErrorMessageInfo)),
         exhaustMap((errMsgInfo) => this.errDlgSvc.showErrorDialog$(errMsgInfo).pipe(map((dlgRes) => clearError())))

Here's how it's initialized:

@NgModule({
   declarations: [AppComponent, HomeComponent],
   imports: [
      BrowserModule,
      AppRoutingModule,
      AppAuthModule.forRoot(),
      StoreModule.forRoot(ROOT_REDUCERS, {
         metaReducers,
         runtimeChecks: {
            // strictActionSerializability: true, ===========> enabling this causes reducers to break, so state do not change!
            strictStateImmutability: true,
            strictActionImmutability: true,
            // strictStateSerializability: true, ====> doesn't work
            strictActionWithinNgZone: true,
            strictActionTypeUniqueness: true
      EffectsModule.forRoot(AppEffects),
      StoreRouterConnectingModule.forRoot(),
      StoreDevtoolsModule.instrument({ maxAge: 25, logOnly: environment.production })
   providers: [
      { provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true },
      { provide: ErrorHandler, useClass: ErrorHandlerService },
      OverlayService,
         provide: GlobalFacadeService,
         useClass: GlobalStateService
   bootstrap: [AppComponent]
export class AppModule {}

Minimal reproduction of the bug/regression with instructions

Probably any project that has a global app state would have this problem.

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

NgRx: 15.0.0
Angular: 15.0.2
Windows 11 x64

Other information

No response

I would be willing to submit a PR to fix this issue