Sergey Karlo
Sergey Karlo

Reputation: 1

Can I get data from an NgRx service without updating cache?

I have my service and need to get data using getWithQuery, but I don't need NgRx store to be updated. I just need to get this data and use them in subscribe method.

I've tried different EntityActionOptions.mergeStrategy but cache is still updated.

Any ideas?

Thanks!

Upvotes: 0

Views: 545

Answers (2)

satanTime
satanTime

Reputation: 13574

The ngrx store purpose is to be responsible for the app state. It means if you want to fetch something you dispatch an action that updates the store and then you select this data from the store.

If you want to fetch data directly skipping the store and select parts - it means you follow against ngrx purpose and perhaps you don't ngrx at all.

If you want to ngrx then consider writing you app in the way that it always puts data into the store if something is updated / fetched and to display the data it's always selected from the store.

Upvotes: 0

timdeschryver
timdeschryver

Reputation: 15505

This isn't possible AFAIK @ngrx/data is bound to the store. If you just need the data, you can invoke the service directly.

Upvotes: 1

Related Questions