How to trigger multiple actions with a signalSlice? #433
-
I'm using My use case is managing user preferences. When a user modifies their preferences I'd like it to immediately update the state (so it's reflected in the UI) as well as making a HTTP request to update the preferences in the backend. As the HTTP request returns the latest saved state I'd then like to re-update the local state with what's returned in the response. Currently using a
Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
@kisamoto you should be able to do this by having your |
Beta Was this translation helpful? Give feedback.
@kisamoto you should be able to do this by having your
actionSource
switchMap to the http request to the backend (and also map the response to the appropriate partial of the state) and then to satisfy the other requirement to immediately update the local state you can pipe onstartWith
to the http request and have it emit the partial you want to set immediately