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
2
votes
1 answer

SelectAll from ngrx/entity doesn't select anything

Intro I'm having some trouble getting my selector to work. My component doesn't update with books from the FakeApiService though I can see the call is made. So the actions and effects are working. I believe the problem is related to my use of…
Snæbjørn
  • 10,322
  • 14
  • 65
  • 124
2
votes
1 answer

Using Array.reduce function with objects in a NgRx application

In a NgRx Angular 5 project, there is a use of the reduce function i don't really understand. I would appreciate some help Basically the code iterates an array of object and the array looks like this: [{ id: '0', message: 'work', done:…
Slrg
  • 129
  • 6
2
votes
0 answers

Normalizing/denormalizing state with angular-redux

I have started a new project with angular-redux and I really like the setup, all is working well. However, the complexity will grow soon and I'm concerned with the store state will become too deep, arrays within arrays - you guys know the…
Rutger van Dijk
  • 330
  • 1
  • 9
2
votes
2 answers

How can the evaluation of a ngrx-store selector be controlled?

I have a selector: const mySelector = createSelector( selectorA, selectorB, (a, b) => ({ field1: a.field1, field2: b.field2 }) ) I know the selector is evaluated when any of its inputs change. In my use case, I need to control…
SFA
  • 21
  • 4
2
votes
1 answer

How to select single item/entity, ngrx?

I have selector to get all posts, actually all entities, now I want to get single post/entity. Should I filter the posts I get from 'getAllPosts' selector or create another one and how to do it ? Here are my selectors: export const getPostsState…
Merim
  • 1,283
  • 2
  • 21
  • 36
1
vote
0 answers

Problem with NGRX effect on success action after api call

I am having the following 3 actions: export const createSite = createAction( '[Site] Create Site', props<{ site: SiteRequest }>() ); export const createSiteSuccess = createAction( '[Site] Create Site Success', props<{ site: SiteResponse…
innoveltec
  • 11
  • 1
  • 4
1
vote
1 answer

How do I automatically refresh my PrimeNG table from data from my ngrx/data service?

I'm using Angular 13 and ngrx/data, store and entity (v.13). I have set up my ngrx/data service export class MyObjService extends DefaultDataService { ... } and then a component using PrimeNg. I have a table to display all my…
Dave
  • 15,639
  • 133
  • 442
  • 830
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
1 answer

Cannot read properties of undefined (reading 'map') NGRX Entity

It happens on the selectAll selector, I Have looked at other answers and I am using a createfeatureSelector, to call the state. I have managed to dispatch actions, save the state to the store but I can't use the selectors. Any help would be highly…
Kav Khalsa
  • 141
  • 3
  • 14
1
vote
2 answers

How to update all entities at once - NGRX?

I need to update the isExpanded property in all entities. I tried to do this with reduce() but got nested objects with v key :/ function updateAllIsExpanded(state, isExpanded): any { return Object.entries(state.entities).reduce( (p, [k, v])…
JanuszFrontEnd'u
  • 451
  • 6
  • 14
1
vote
2 answers

How to sort entities by any property in ngrx

In the documentation I found a simple example using sortComparer, the problem is that we only sort by name and if I want to do it by different properties, I have to somehow provide information about the key / property. I know that I can keep sorting…
JanuszFrontEnd'u
  • 451
  • 6
  • 14
1
vote
0 answers

how to use selectors with a combineReducers when one of the child reducers relies on adapter?

students.reducer.ts export const StudentsFeatureKey = 'students'; export interface StudentState { studentProfile: fromStudProfReducer.StudentProfileState; studentAdmin: fromStudAdminReducer.StudentAdminState; } export const reducer =…
Richard77
  • 20,343
  • 46
  • 150
  • 252
1
vote
1 answer

NGRX createSelector object get middle line, when create special selector with filter (Update to NGRX 2021)

Hello guys I am create a selector that filter some thinks from the store but when I implement that on selectors it create a line on the object. The selector work properly but I see middle line on it like something isn't 100% well. How can I fix it?…
Lichay Tiram
  • 283
  • 3
  • 12
1
vote
1 answer

Using @ngrx/data, how can you form JSON patch documents from updates to entities on a custom data service?

My use case of @ngrx/data requires that I build custom entity data services by extending DefaultDataService. The API I am working with accepts JSON patch documents for updates. EntityCollectionDataService defines the following function for…
Colin
  • 624
  • 8
  • 27
1
vote
1 answer

@ngrx/data How to cancel request providing with getAll, getWithQuery, getByKey

I use ngrx/data in my app. I have a very quick application. You can select something on UI and I need to update my view. A user can do it very quickly, I do not need any previous data from previous requests in that case. But when I add switchMap -…