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

How do I set entity in ngrx if it is not an array?

I am learning ngrx/data From the code sample on line, it uses heros(plural) import { Component, OnInit } from '@angular/core'; import { Observable } from 'rxjs'; import { Hero } from '../../core'; import { HeroService } from…
Hello
  • 796
  • 8
  • 30
1
vote
1 answer

Service is called multiple times inside NgRx Effect

When I dispatch an action, service is called more than one time inside effect and I have to use "exhaustMap" instead of "concatMap" or "mergeMap" in all effects every time, and I do not know how it happened suddenly because it was OK before. And I…
Jalaleddin Hosseini
  • 2,142
  • 2
  • 25
  • 28
1
vote
1 answer

ngrx component store effect not triggering after promise errors out

My Implementation Hi everyone, I am using ngrx component store for my supabase project, There is a delete method in supabase to delete a particular row, If that delete (which is a promise) a product that errors out, I am handling that exception in…
1
vote
1 answer

How to resolve the "Avoid dispatching many actions in a row" lint warning in NgRx?

I am getting this warning when I have a lot of actions in a component function: Avoid dispatching many actions in a row to accomplish a larger conceptual "transaction", I want to resolve this warning, but I don't have a good approach to revolve, I…
Tabares
  • 4,083
  • 5
  • 40
  • 47
1
vote
1 answer

ngrx - update value in nested object

I'm getting this error: Cannot assign to read only property 'active' of object '[object Object]' I know that the message means, I can't work on the state directly. Overall i'm trying to switch a boolean. my reducer is on(ConfigsActions.toggle,…
1
vote
2 answers

NgRx: load list of items, and after for each load item them status

I want to display a list of items to the user in 2 steps. First the simple list in a single request to an API. Then when it's done, load the status of each item one by one with multiple requests to an API. the first list is quick to obtain, on the…
1
vote
0 answers

Why is @ngrx/component tagged as experimental?

I've been using @ngrx/component for about 3 years (if I recall correctly) and I've been super satisfied! I've also worked with it on environments with no zone and it's amazing. I want to introduce it to my new colleagues though, but this tags stops…
1
vote
1 answer

Using keys in StoreModule.forRoot and keeping the selector scoped to only state

I am using the property key 'auth' to scope the reducer in the StoreModule.forRoot setting so I can add other reducers in the future. But this seems to conflict with my selectors. ./app.module.ts @NgModule({ declarations: [ AppComponent, ], …
Remi
  • 4,663
  • 11
  • 49
  • 84
1
vote
1 answer

How can i replace retryWhen on this ngrx effect?

I have this code that work as intended: i dispatch a signin function the effect take data fom action and make http post if the error status is 504 i retry the http post if it's all ok -> success action else error action authSignIn$ =…
1
vote
1 answer

Ngrx / rxjs Action Prop becomes immutable

I am finding that props that I send into actions (ex: a class model with search criteria to send to the API) are becoming immutable and I can not modify the properties of that class. Now, I understand that reducer / store objects are immutable, but…
adova
  • 950
  • 1
  • 8
  • 14
1
vote
1 answer

NgRx effect that conditionally loads data - how to handle loading flag?

I've moved from imperative actions to purely past-tense actions, and I really like how it moves app intelligence out of my components and into my Effects. I used to use something like... this.store.dispatch(MemberActions.loadMembers()); ...in my…
Tim Hardy
  • 1,654
  • 1
  • 17
  • 36
1
vote
1 answer

Getting error while trying to install ngrx in Angular application

I am trying to install ngrx in my Angular application. I have executed the command ng add @ngrx/store@latest But it results in an error as follows npm resolution error report 2022-07-07T20:36:16.089Z While resolving: crudapp@0.0.0 Found:…
Athulya Ratheesh
  • 291
  • 4
  • 22
1
vote
2 answers

Edit(Mutate) object property inside a reducer in NgRx

I'm having troubles when trying to edit a property inside an object. I'm using PokeApi to fetch Pokémon and then, with a button, add them into a cart. Interface export interface PokemonModel { name: string; url: string; quantity: number; …
jgcarrillo
  • 148
  • 11
1
vote
1 answer

In Angular 7.2.7 my Effect runs before my Reducer despite documentation suggesting that reducers run before effects

this stackoverflow: NgRx - Order of execution of Reducers and Effects says that effects run before reducers in ngrx. However my effect: @Effect({dispatch:false}) updateToken$ = this.actions$.pipe( …
1
vote
1 answer

Angular 12 SSR - routes having canActivate does not work on page reload

I have angular 12 project in which I have applied Angular universal(ssr). I have deployed that project on nginx server. Application works fine but if user press browser reload for routes on which I have applied canActivate does not reloads…
ganesh
  • 416
  • 1
  • 11
  • 32