Signal Store: Custom Store Feature requires withEntities from feature-using store #5027
Unanswered
ChristopherAdamINF
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to seperate my entity signal store into reusable parts.
I have a main store file, that defines which entities are used and the an initial state, and then a number of features that add functionality and more fields to the state.
Basically I want to type the store within the feature in a way, that enforces that it already has withEntities.
This problem is very similar to #4767, however in his final solution Donnerstagnacht did not use any of the entity management functions like addEntity, which are causing my problems.
I also tried the suggestion from this comment: #4767 (comment) which does work, but causes ngrx to throw warnings at runtime which I don't want.
I'll add a simple example using the similar code as the documentation: https://ngrx.io/guide/signals/signal-store/custom-store-features#creating-a-custom-feature-with-input
My main store
My feature
The type mismatch
While this might look like unneccesary seperating, my actual project has multiple generically typed features that multiple large stores use like modular building blocks. This is just a small example to highlight the issue.
Looking forward to help and suggestions!
Beta Was this translation helpful? Give feedback.
All reactions