You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provide an API that allows binding a stream of actions to NGXS.
Describe the problem you are trying to solve
Please describe the problem. If possible please substantiate it with the use cases you want to address.
Often a UI element provides a stream of events based on user input, for example, a search field would provide a change$ stream which could be denounced in the component.
Today the way to connect this stream of events to the state is by mapping each event emission of this observable to an imperative call to this.ngxsStore.dispatch. Breaking, therefore, the reactive nature of the code and also requiring the maintenance of the subscription on the component side.
Similarly, this would allow the implementer to decide which strategy to use to merge his actions in the stream, for example:
Load operation - exhaustMap
multiple update/delete operations - concatMap
Search operation - switchMap ( already possible with {cancelUncompleted}
Describe the solution you'd like
If you have a solution in mind, please describe it.
Provide an API that allows binding a stream of actions to the state avoiding the need to comparatively call this.ngxsStore.dispatch in a map operator. An initial proposition usage could be:
Relevant Package
This feature request is for @ngxs/store
Description
Provide an API that allows binding a stream of actions to NGXS.
Describe the problem you are trying to solve
Please describe the problem. If possible please substantiate it with the use cases you want to address.Often a UI element provides a stream of events based on user input, for example, a search field would provide a
change$
stream which could be denounced in the component.Today the way to connect this stream of events to the state is by mapping each event emission of this observable to an imperative call to
this.ngxsStore.dispatch
. Breaking, therefore, the reactive nature of the code and also requiring the maintenance of the subscription on the component side.Similarly, this would allow the implementer to decide which strategy to use to merge his actions in the stream, for example:
{cancelUncompleted}
Describe the solution you'd like
If you have a solution in mind, please describe it.Provide an API that allows binding a stream of actions to the state avoiding the need to comparatively call
this.ngxsStore.dispatch
in a map operator. An initial proposition usage could be:Initial discussion
The text was updated successfully, but these errors were encountered: