Questions tagged [ngrx]

NgRx is a reactive state management library for Angular based on flux design pattern.

NgRx provides a set of reactive libraries for Angular.

It includes:

Store: RxJS powered state management for Angular applications, inspired by Redux

Effects: RxJS powered side effect model for @ngrx/store

Entity: Entity State adapter for managing record collections.

Router-Store: Bindings to connect the Angular Router with @ngrx/store

Store-DevTools: Developer Tools for @ngrx/store

DB: RxJS powered IndexedDB for Angular apps


See Official Docs for more Info

4430 questions
1
vote
1 answer

NGRX state update

this is my State:- roles =[ { roleId:"8e8be141-130d-4e5c-82d2-0a642d4b73e1" name:"HR" description:"HR of the Company" isModerator:"N" }, { roleId:"8e8be141-130d-4e5c-82d2-0a642d4b73e1" name:"MR" description:"MR of the…
Benezir
  • 113
  • 1
  • 9
1
vote
1 answer

How to reload data when "hard navigate" with ngrx/store?

In my application I retrieve all data in the "Items-Overview-Component" in the constructor. (router path: "/items"). // Items-Overview-Component constructor(private store: Store) { this.store.dispatch(loadItems()); } When…
EchtFettigerKeks
  • 1,692
  • 1
  • 18
  • 33
1
vote
1 answer

NGRX: is it an antipattern to listen for chain of actions dispatched in specific order?

I find the following pattern usefull and versatile: effectXY$ = createEffect(() => this.actions$.pipe( ofType(actionX, actionY), switchMap(() => this.myApi.something() .pipe( map(() => actionZ()) …
Biiz
  • 349
  • 4
  • 18
1
vote
1 answer

How to combine concatMap and exhaustMap in elegant way?

I have a CreateReviewForm with reCaptcha and I have 3 streams for it: ngRx action (addReview) (1st observable). Everytime when this action is triggered I have to call this.recaptchaV3Service.execute() method which returns observable with token…
missbells
  • 43
  • 4
1
vote
1 answer

unit testing is failing for ngrx-effect?

Unit test is failing for ngrx effect. Effect method code: addNewLedgerAccountRequest$ = createEffect(() => this.actions$.pipe( ofType(AddNewLedgerAccountActions.AddNewLedgerAccountActionTypes.ADD_NEW_LEDGER_ACCOUNT_REQUEST), …
Cluadia Hedda
  • 121
  • 1
  • 7
1
vote
1 answer

How to select a unique entity by id from the ngrx-entity store

I have in my ngrx-entity store the prsnls entity well described as array of objects as shown in redux devtool. I'm able to select all prsnl entities like this: export const selectAllPrsnls = createSelector( selectPrsnlState, prsnlsState =>…
Himmels DJ
  • 395
  • 5
  • 20
1
vote
2 answers

How to test NgRx Effect that uses event from dependency injected service

I have following effect that uses the an observable source from a PlatformService provided by Angulars Dependency Injection. public resume$ = createEffect(() => { return…
Pascal
  • 75
  • 8
1
vote
2 answers

How to combine 3 reducers into one mainReducer and register it in Module using StoreModule.forFeature()

I have 3 objects implementing 3 different interfaces that I'm managing theirs states with ngrx (latest versions). The reducers are defined as: loginReducer, PrsnlReducer and userReducer. I'm handling the PrsnlReducer and the userReducer as ngrx…
Himmels DJ
  • 395
  • 5
  • 20
1
vote
1 answer

NgRx sort and update Array inside object in state

Cant assign sorted array back to state. The interface type IDataSet assigned to the subComponentData looks like this. arrOut is sorted but if I try to assign it back to gridDataArray it does not work. I get a type mismatch {}[] is not [{}]. export…
howserss
  • 1,139
  • 1
  • 8
  • 12
1
vote
1 answer

Angular RXJS Make multiple http parallel calls after first request get done

After receiving the initial request response, I need to perform three parallel requests in my ngrx Effect. I implemented the following, however when I inspect it using the network tab, all three requests are queued. and all queries are executed…
Thushara
  • 236
  • 3
  • 19
1
vote
0 answers

Ngrx entity (data) multiple entity delete wrong types included for a rest backend

I am currently struggling with deleting multiple entities and the save multiple entities pattern in NgRx. Here is the current problem: My UI EntityCacheService: @Injectable({ providedIn: 'root' }) export class PlayerService extends…
1
vote
1 answer

ngrx how to dispatch an action before http call in effect

I am new to ngrx / reactive pattern. I am trying to redesign some complex forms that we have from a template driven approach with component driven models to reactive forms using ngrx. due to the way our api is written, some of the data from the form…
Tom Yee
  • 69
  • 6
1
vote
1 answer

How to Get only last value from store?

This is use of my Selector:- private loadTree() { this.loading = true; this.store.select(transitionListSelector).pipe().subscribe(data => { console.log(data); data.map(item => { console.log(item); …
Benezir
  • 113
  • 1
  • 9
1
vote
1 answer

Ngrx effect returns returns object instead of array

I'm trying to get data from api using ngrx effects, the code works correctly, however, when I want to get the animals array for some reason returns { animals:array, loading:true }. Even I specified that I only want the animals atribute simply…
Ramiro
  • 44
  • 6
1
vote
1 answer

Can't update state property that represented by interface in reducer

Problem decryption: a property of ngrx state interface are represented by other interface and this interface has nested interface too. I have an action that receive new value for nested property from server and when I try to assing new value in…