ngrx / platform

Reactive State for Angular
https://ngrx.io
Other
7.96k stars 1.95k forks source link

Effects issue after upgrading to angular@18 and ngrx/effects@18 #4411

Closed calvinramp closed 1 week ago

calvinramp commented 1 week ago

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

effects, entity, store-devtools, store

Minimal reproduction of the bug/regression with instructions

We have multiple effects importing into the forRoot in our app.module.ts

app.module.ts eg.

import { effects } from './store/effects/index';
EffectsModule.forRoot(effects),

./store/effects/index.ts

import { ProductEffects } from "./product.effects";
import { ScenarioEffects } from "./scenario.effects";
import { OrganisationEffects, UserEffects, UserManagementEffects } from "../../views/user-management/redux/effects";
import { ActivityEffects } from "../../core/activity/store";
import { AnalyticsEffects } from "./analytics.effects";
import { PageEffects } from "./page.effects";
import { ReportingEffects } from "./reporting.effects";

export const effects = [ProductEffects, ScenarioEffects, UserManagementEffects, UserEffects, OrganisationEffects, ActivityEffects, AnalyticsEffects, PageEffects, ReportingEffects]

When using the vite builder of angular 18 we are seeing the following in the console. Screenshot 2024-06-25 at 12 44 05

Expected behavior

I'd expect it to work as it was or is there some other way to import multiple effects.

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

NgRx: 18 Angular: 18 Node: v20

Other information

No response

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

calvinramp commented 1 week ago

I found the source of my problem, I had the 2 of the effects registered in forRoot and forFeature in a submodule.