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

NgRx EntityState - Can we use EntityState on a state object property

Continuing with my new journey into NgRx, I just discovered EntityState, and if I am understanding, and trying to use it correctly, it covers all the "collection manipulation" operations I need to do for me! I have followed this excellent tutorial,…
peterc
  • 6,921
  • 9
  • 65
  • 131
1
vote
0 answers

@ngrx/entity How to update an item multiple levels deep

Say I have a state slice that looks like the following: { "ids":[20,23,32,60,101], "entities":{ "20":{ "id":20, "name":"Actor", "questions":[{ "id":20, …
ChrisBratherton
  • 1,540
  • 6
  • 26
  • 63
1
vote
0 answers

NgRx Entity filter state based on property

I need to remove selected "archivados" inside my reducer. Is there any way to filter the current state? I fount the following solution, but I think there should be a better way to do this. export const adapter: EntityAdapter =…
Sergio Tx
  • 3,706
  • 1
  • 16
  • 29
1
vote
3 answers

How to define selectId for entity adapter when the relevant id is defined on the backend?

I'm dispatching the upsert action/ reducer on my store to add a new record to state and there is an effect that will call the backend and add the record/ document to my mongodb instance. Given that the only sensible id for this particular model is…
ldgorman
  • 1,553
  • 1
  • 14
  • 39
1
vote
1 answer

Should ngrx entities be stored at a feature level or at an app level?

I am trying to build an application using ngrx. As an exemple, let's say that this is a project management application (such as Jira). Requirements say that it should be built using ngrx. In this application, I've identified the following…
Despo
  • 51
  • 5
1
vote
1 answer

Reset - Redux throws dispatched an invalid action: undefined

I am trying to reset my redux-store on based of logout, but getting following error. Looking for better suggestion to reset my redux-store state so as everywhere I found to set it to undefined will help the case, but in my case it is not working. …
user366584
  • 1,016
  • 1
  • 16
  • 34
1
vote
1 answer

Angular store state undefined

I have an Angular 7 application which uses the ngrx-store with entities. There is a problem in that the elements of my store state are undefined in my effect. Here is a snippet of the effect: @Effect() loadAccountSummaries$ = this.action$.pipe( …
serlingpa
  • 12,024
  • 24
  • 80
  • 130
1
vote
1 answer

NGRX how to handle sorting performed at the backend

What is the best approach to handle sorting entities performed at the backend side? Currently, my state does not recognize that something changed when I adding sorted items using adapter while items still are the same as before sorting but them…
Stefan
  • 1,431
  • 2
  • 17
  • 33
1
vote
0 answers

ngrx create nested state by domain and ui data

I'm using ngrx entities, and ideally I would like to achieve the following state structure: state = { domainData: { userEntities: { entities: {}, ids: [] } }, ui: { usersView: {} } } This…
Mister_L
  • 2,469
  • 6
  • 30
  • 64
1
vote
1 answer

ngrx entities adapter addAll and nested state

I have a scenario where I have a list of users on a users page. Each user has his own list of apps, and when a user is clicked, the corresponding list of apps is displayed. I would like to use the ngrx entity adapter, but first I need to design my…
Mister_L
  • 2,469
  • 6
  • 30
  • 64
1
vote
2 answers

ngrx: set deafult value for entities

How can I set a deafult value for entities while initiate state in ngrx entities? potato.model.ts export class Potato { id: number; weight: number; } potato.reducer.ts export interface PotatoState extends EntityState { } export…
hofshteyn
  • 1,272
  • 4
  • 16
  • 33
1
vote
2 answers

angular NGRX: Not able to select single value in ngrx entity based on id

I am trying to select an object by Id from the entity state. Below is my reducer. export interface MessageState extends EntityState { // additional entities state properties loaded: boolean; loading: boolean; } export const adapter:…
prabhat gundepalli
  • 907
  • 3
  • 15
  • 39
1
vote
0 answers

Updating an ngrx entity from a reactive form

I have a container component which subscribes to an @ngrx/store and renders a list of components which internally have a form. The component hierarchy is like the following: // orders-list.component.ts export class OrdersListComponent { //…
nerazzuri
  • 11
  • 2
1
vote
1 answer

@ngrx/entitiy selector doesn't fire when changing custom state

I have expanded a @ngrx/entity state store to include a loading value for the entities that should be retrieved from the server. const adapter = createEntityAdapter(); export interface AState extends EntityState { loading: { projects: { …
Jason
  • 654
  • 1
  • 11
  • 27
1
vote
0 answers

ngrx state- when to flatten state?

There are strong recommendations to flatten out the state tree for an ngrx store, and I've worked to do so throughout my app. I understand with, and agree with the reasons behind doing so- flat state trees are easier to manage, deep copy,…
MarkD
  • 4,864
  • 5
  • 36
  • 67