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:
- dispatch
Action
- invoke
Effect
--> call backend - update
store
with data from backend - component uses
selector
to get the data
Now 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:
- dispatch
Action
- invoke
Effect
--> call backend - component listens for
ApiCallSuccess
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.