-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
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
provideState(feature,reducers) throws an exception when used after StoreModule.forFeature(...) #4063
Comments
Are you importing these modules in the |
Good catch @brandonroberts , I didn't notice that it was provided via the component. |
Am I to understand that NgRX will only support both ways (StoreModule.forFeature() and provideStore()) if the app component is not a standalone component? But, if there is an App Module, you can have a mix of standalone components and module based components under it? If this is so, I don't understand why it is the provideStore() that isn't working. |
@DaveMBush essentially, yes. If you're using a standalone setup, I'd expect you to only use standalone APIs for NgRx. Using StoreModule.forFeature and provideState together is more for compatibility with primarily module-based setups. The reason is doesn't work is because a component doesn't do anything with |
Which @ngrx/* package(s) are the source of the bug?
store
Minimal reproduction of the bug/regression with instructions
https://stackblitz.com/edit/demo-of-ngrx-bug?file=src%2Fapp%2Fshared%2Fshared.module.ts
When you run the application, it throws an exception. on line 1343 of ngrx-store.mjs. It seems that featureReducers and features are out of sync. It does not matter what order I provide the new features in.
Also it does not matter if I use StoreModule.forFeature() in the imports section or if I use it inside importProvidersFrom().
If I add two features using StoreModule.forFeature() it works as expected. No exceptions and the store is usable.
As the error is evident without selectors or actions I've created the bare minimum code (no actions or selectors) to produce the error in the stackblitz
Expected behavior
No exception and the new feature store is added.
Versions of NgRx, Angular, Node, affected browser(s) and operating system(s)
NgRX 16.3.0
Angular 16.2.8
Other information
No response
I would be willing to submit a PR to fix this issue
The text was updated successfully, but these errors were encountered: