Replies: 2 comments 4 replies
-
Well, there is nothing really built-in for Do you have some use cases? Maybe, this could be a required feature. |
Beta Was this translation helpful? Give feedback.
-
Our use case is a store that creates a "manager" object for each entity that is added to the store and ensure a 1-to-1 mapping with identical IDs for both. The idea is that when we receive plain JSON objects from the backend, we can put them to the store - and for each one create another object that provides computed stuff, to e.g. apply defaults (but also more complex computations) without altering the original objects and update when the entity changes. Or, is there already a way to add computed signals and methods for each entity in a store? Another idea for a use cases of watchEntities() could be the handling of external resources that are linked to each entity, requests that should be made to fetch details or similar. |
Beta Was this translation helpful? Give feedback.
-
Scenario:
I use a
signalStore(withEntities<Entity>() /*...*/)
.I have a use case when I want to trigger some other updates whenever an entity in the store is added, updated or removed.
I'd like to use an
effect()
- but I miss an simple & elegant solution to find out about what changed since last call of the effect function.I even don't get the previous store state so I can compare myself.
Any suggestion?
Ideally, I'd like to have something like
AI suggested to do something like:
So I'd say it's simple to augment my modification methods to trigger the actions.
Beta Was this translation helpful? Give feedback.
All reactions