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

Verify existing feature state is added in NGRX Store

Below I have an example of what I am currently facing in the app: app.module.ts @NgModule({ ... imports: [StoreModule.forRoot(reducers)], ... }) export class AppModule {} store users: {...} articles.module.ts @NgModule({ ... imports:…
Andres2142
  • 2,622
  • 2
  • 14
  • 19
1
vote
1 answer

Configure Angular Routes with Auth0s AuthGuard

I would like to configure my lazy loaded routes nested, which are only available if the users is logged in. Authentication works with Auth0s and it's corresponding AuthGuard. So for example my routes look like this : const routes: Routes = [ { …
1
vote
2 answers

how to return ActionReducerMap properly

I have defined my reducers like this import { Action, ActionReducerMap, createAction, createReducer, on } from '@ngrx/store' import AppUser from 'src/app/shared/models/app-user'; import { AuthActions } from '../auth.action.types'; export…
Raas Masood
  • 99
  • 12
1
vote
0 answers

Order of Effects/Reducers when one Effect class uses ngrxOnInitEffects

I'd like to confirm behavior I am observing when I have an Effects class implementing ngrxOnInitEffects, since I hope to rely on the observed behavior. I have two features A and B in the same app. A has Effects, Reducers, and Selectors. B has…
BrianD
  • 11
  • 1
1
vote
1 answer

Getting error while trying to add ngrx store after ESLint

I have an angular 13 application with ESLint already in place. I have added ngrx store and dev tools using ng add @ngrx/store ng add @ngrx/store-devtools commands. now when I try to add store ng g store shared/Shared --module shared.module.ts …
Raas Masood
  • 99
  • 12
1
vote
1 answer

Register ngRx effect on a "success" action? Or should this be decoupled with a service?

Currently I subscribe a ngRx effect on a "success" action (assuming my action is loadDataSuccess)? createEffect(() => { return this.actions$.pipe( ofType(loadDataSuccess), ... It somehow stings in my head, that this is bad practice. Is…
Herr Derb
  • 4,977
  • 5
  • 34
  • 62
1
vote
1 answer

How can I determine the number of values has been emitted during the debounce time?

Given: An NgRx effect that handles a request to "zoom in" a display. It gets a notification every time users click on an appropriate button. public readonly zoomIn$ = createEffect( () => this.actions$.pipe( ofType(zoomIn), …
Anton Kochev
  • 300
  • 1
  • 3
  • 13
1
vote
1 answer

Angular 13 - Cannot use namespace as a type.ts(2709)

Am working on angular 13 version.Trying to import and use action file inside a .spec file shows an error like below Cannot use namespace 'MyActions' as a type.ts(2709) This is my spec file import * as MyActions from…
arj
  • 887
  • 1
  • 15
  • 37
1
vote
0 answers

NGRX effect stale R3Injector after destroying and reinitialising module

I am attempting to use module federation along with ngrx store & ngrx effects in my webapp which is all in working order for the most part. However, I wish to destroy my NgModuleRef when switching to another lazy loaded route. Hence if I have one…
1
vote
1 answer

NgRx how to wait for the end of an Effect execution

How to wait for the completion of an Effect in NgRx. I am stuck in this situation. I have an effect that loads a token from the storage and the dispatch an action to update the Store depending that the token was found or not. autoLogin$ =…
akuma8
  • 4,160
  • 5
  • 46
  • 82
1
vote
1 answer

Angular ngrx component store .select method

I am trying to find the .select method of ngrx but I cannot really find details on it on internet. What I need is to find out about the overloads of this .select() method. Like, the simplest form is .select(state => state.someSlice) But I saw…
Vladimir Despotovic
  • 3,200
  • 2
  • 30
  • 58
1
vote
1 answer

How to update state data without api call with ngrx store?

I have a users list and I want to be able to update each user's details (in a modal) and keep them in the state(no API call for update). I'm trying to do this with effects but I'm not sure what is the correct way to achieve it. Actions:…
marf
  • 13
  • 3
1
vote
0 answers

Refresh value from ngrx store after delay, best approach...?

I'm using the code below in my Angular app to show a loading spinner. It selects the isLoaded value from the store, pipes to delay(500) and then refreshes the value of isLoaded from the store, this is so that the spinner only shows if still…
chumtoadafuq
  • 256
  • 5
  • 14
1
vote
3 answers

Angular - ngrx - Effect for continually getting data from server

Setup Angular 13.2.0 Ngrx 13.0.2 Backend: Spring Boot Goal I want to continually get the data from the backend. The data is changing and i want to reflect those changes in the angular-app. What works so far pollingfetchEntities$ = createEffect( …
Hesk
  • 307
  • 4
  • 16
1
vote
1 answer

use ngrx effect for api request but dont store result in store

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…
matthias
  • 1,938
  • 23
  • 51