Questions tagged [ngrx-entity]

Entity State adapter for managing record collections with ngrx

@ngrx/entity provides an API to manipulate and query entity collections.

  • Reduces boilerplate for creating reducers that manage a collection of models.
  • Provides performant CRUD operations for managing entity collections.
  • Extensible type-safe adapters for selecting entity information.
177 questions
1
vote
1 answer

Cannot read property 'map' of undefined using angular with ngrx

I need help to understand this error that happens when I try to use an Observable array that comes from store. this is the console error ERROR TypeError: Cannot read property 'map' of undefined at ngrx-entity.js:67 at ngrx-store.js:1198 …
1
vote
1 answer

How to create item without passing id from angular app to firestore with ngrx/entity?

I am trying to perform a full CRUD operation using Angular + Cloud Firestore + NGRX/Entity. Id is required parameter to perform ngrx/entity. But when I create an item from my angular form to my firestore, I don't know yet the id as it would be…
1
vote
1 answer

How can I execute an Action/Effect after properties in my state are initialized?

I have a store for a component that is new with each new component declaration. In ngOnInit I need to set the value of three properties on the state of the reducer. After that is executed, I need to call another dispatch which fires off an effect…
RLH
  • 15,230
  • 22
  • 98
  • 182
1
vote
0 answers

ngrx effect doesn't run if the action is dispatched from another module

So here's what i'm trying to do. Under a lazy-loaded BookmarksModule feature module, i have an effect that listens to authActions.loginSuccess w/c is registered in a AuthModule w/c is not lazy-loaded. @Injectable({ providedIn: 'root', }) export…
The.Wolfgang.Grimmer
  • 1,172
  • 2
  • 9
  • 32
1
vote
0 answers

NGRX confusion on how to implement array of arrays

I'm really brand new to NGRX and state management. I have successfully implemented my first state key using entity and selectors. It loads everything with a facade and an effect into state with key containers. Though I'm trying to figure out how…
lumberjacked
  • 966
  • 1
  • 21
  • 35
1
vote
2 answers

Angular @NGRX/Entity: selectAll gives 'ids' undefined error

I've been running through tutorials on NGRX and have tried to implement a UserAdapter with a custom id from MongoDB _id. So I got the whole custom id working but I keep getting this error ERROR TypeError: "ids is undefined" from the select all…
bloo
  • 1,416
  • 2
  • 13
  • 19
1
vote
1 answer

How to create or delete multiple data together with ngrx?

In conjunction with all the "flux architecture" (actions, effects, reducers etc ...) and rxjs I am trying to create and or delete multiple data. And I have the following problems: How to create or delete multiple data both in the backend and…
user11472365
1
vote
1 answer

Is it possible to unite Reducer's ActionCreators?

I was thinking of joining some "on()" which do exactly the same thing, thus saving lines of code, is this possible? Giving an example of my code: const peopleReducer = createReducer( INIT_STATE, on(fromPeopleAction.GET_ALL_SUCCESS, (state, {…
user11472365
1
vote
1 answer

Should I separate same entity collections for two components?

I'm facing following problem at work: In SPA I am working at I have task entity and dashboard feature. Also I am aiming to use ngrx store & entity to handle state management in app. Dashboard feature is splitted into components called schedule and…
pyskp
  • 93
  • 1
  • 7
1
vote
1 answer

Argument of type 'X' is not assignable to parameter of type 'Y" with NGRX

I'm creating a people reducer... However, we know that requests may very well fail and that is why I inserted in getInitialState() some properties such as data, error and loading. The data is an object of type People to be able to enter the values…
user11472365
1
vote
1 answer

How to create a NGRX effect which takes a record from state every 5 seconds if available?

I want to create a queue of messages using NGRX which each message added to queue should be displayed for 5 seconds and then removed from state, null value should be assigned to currentMessageId after the last message in queue timed out message…
Kolahzary
  • 31
  • 5
1
vote
1 answer

Angular ngrx-data write service response into separate entityCache sections

I'm currently working on a project where ngrx-data is used to store the information. So far it works great, but now I want to store the entity data from an endpoint which gives me two separate entity types in its response. { "posts": [ { …
PaNic175
  • 330
  • 4
  • 12
1
vote
1 answer

My action is not calling associated reducer and effect

my action - export class RefreshToken implements Action { readonly type = GeneralActionTypes.refreshToken; constructor(public token: string) { console.log('%c action called ', 'background:#00e;color:#000', token); } } associated effect…
samar taj Shaikh
  • 1,165
  • 11
  • 18
1
vote
3 answers

How to select multiple states in NgRx

@Injectable() export class UsersResolver implements Resolve { loading = false; constructor(private store: Store) { } resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable { return this.store …
Amit Sharma
  • 668
  • 1
  • 6
  • 14
1
vote
2 answers

Angular Ngrx 8 Selector error: Cannot read property 'map' of undefined

I am struggling with Ngrx 8 Selectors. I have managed to query data and save it into the store, but I get this error "Cannot read property 'map' of undefined" whenever I try to use selectors. Effects File(ects-users.effects.ts) import { Injectable…
Daniel Chikaka
  • 1,432
  • 4
  • 17
  • 28