Stop using ngrx/effects for that

Stop using ngrx/effects for that

Sometimes the simplest implementation for a feature ends up creating more complexity than it saves, only shoving the complexity elsewhere. The eventual result is buggy architecture that nobody wants to touch.

[…]

Your component needs data from the store, but the data needs to be fetched from the server first. The question is, how can we get the data into the store so the component can select it?

[…]

In the component we trigger the request by dispatching an action:

[…]

In the effects class we listen for both actions now:

Okay. Now another developer adds a component that needs the same HTTP request to be made (no assumptions should be made about other components). The component dispatches the same actions in the same places. If both components are active at the same time, the first component to initialize will trigger the HTTP request. When the second component initializes, nothing additional will happen because needUsers will be false. Great!

[…]