I am working on an Angular project which is using ngrx/store
.
A component of mine needs data from the backend. So the flow usually is like this:
Action
Effect
--> call backendstore
with data from backendselector
to get the dataNow we have the case that our backend returns lots of data (e.g. 100.000) entries. For some reasons I can not do pagination.
I am currently thinking to NOT keep the 100.000 entries in the store
since the data is not used anywhere else in the app (SHARI principle violated). Would you think this is a good idea:
Action
Effect
--> call backendApiCallSuccess
Action
and uses data from payload.The benefit from my side would be: We always use Effects
to call the backend (consistency).
What would you suggest? The alternative to me is that the component
just calls the API and uses data directly.
Both options have pros and cons - and I think that it's your choice and your teams choice.
You can also take a look @ngrx/component-store which is a middle ground, and a good fit for state that is bound to the component's lifestyle.