
We are pleased to announce the introduction of the Events plugin for NgRx SignalStore, released as part of NgRx v19.2! This new addition brings the...
For further actions, you may consider blocking this person and/or reporting abuse
Yeah, what a great feature!! Thanks!
For a future NGRX article, would love to see how Signal Store could combine with the new angular
httpResource
😉Awesome!!! I love this plugin!
by using
on
we don't have the access to the prev state. Now only the payload is availableIt's possible of course. Check the "Performing State Changes" section:
Example:
Any chance a couple of example with updateEntity or setEntity can be added to the article?
I'm fighting with this but keep getting type errors.
The state updater needs to be returned directly to the case reducer handler as a result. In your example, the state updater is returned from another state updater. To fix it, you should execute the updater returned by the
setEntity
function:This can be simplified if the case reducer handler has the current state as the second argument:
If you want, feel free to open a feature request for this in the NgRx repo: github.com/ngrx/platform/issues
I'm such a noob XD thank you <3
Just trying this out. It looks like a great start.
One discomfort I have (I don't have a good solution for this yet) is...
withReducer(
on(usersPageEvents.opened, usersPageEvents.refreshed, setPending)
There's a coupling there between the reducer and the effects. The reducer "just knows" that the effects are going to do something that involves starting an async process that should cause the "Pending" state to get set. This just feels wrong. It's intelligence/knowledge that the reducer has about the effects and what they're going to do, and that entire concept feels wrong. What if we decide in the future that the usersPage opening should no longer automatically fetch users? The point and benefit of abstractions is that they have no knowledge of what happens "when a page opens" or somesuch.
I don't have a good solution for this yet, but I just wanted to voice it. The only solution at all that comes to mind is an extra event that more explicitly states we are fetching users (that gets dispatched as a result of a page opening), but that seems like it would get very verbose. I haven't decided what would feel good here, but I wanted to voice the discomfort.
In large apps that are slowly migrating from NgRx Store to NgRx Signal Store, is there a method to get a Signal Store Effect to listen to NgRx Store Actions?
I know it's early days, but if the team can't provide this, many people will create a lot of ugly code.
Triggering effects:
provideEnvironmentInitializer(() => inject(RouterStore))
Is there an example repo with all of this working in it?