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
19
votes
4 answers

How to select a single object by id using @ngrx/entity

Using @ngrx/entity I want to select an entity by a single id or an array of entities by an array of ids from an entity map. I do not want the select subscriptions inside a component to be triggered when the entity collection gets a new element or an…
vachee
  • 395
  • 1
  • 4
  • 15
13
votes
1 answer

Could I store object with its methods in @ngrx

I wanted to store objects with their methods with @ngrx/entity . Can it cause any problems in application? (Angular 2-7) mission.class.ts: import { v4 as uuid} from 'uuid'; export class Mission { id: string; title: string; completed:…
Itzhak Galitch
  • 366
  • 4
  • 19
10
votes
3 answers

How to addOne item at the beginning of collection in ngrx/entity

I started using ngrx/entity package, where I can manage store by adapter. There is addOne method I'd like to use, but it adds item to the end of collection. I wanna add one at the beginning. Could you please help me with that? How to add item at the…
magos
  • 3,371
  • 4
  • 29
  • 54
9
votes
4 answers

Is it possible to change the id in ngrx/entities?

Is it necessary to have ids in ngrx/entities that will not be changed? I want to use string property path as id. It is uniq. But it can be changed. Should I use uuid as ids in this case?
mr__brainwash
  • 1,334
  • 3
  • 16
  • 40
8
votes
3 answers

how to update or remove the nested object inside ngrx entities?

how to update or remove nested object inside ngrx entities for example I want to delete the first element which has the 19 id from (charter.entities.scopes.data) as it shown in the bellow stored json object inside my ngrx store charter: { …
user2620132
  • 155
  • 1
  • 1
  • 10
8
votes
1 answer

How to update a subset of entities with ngrx-entity?

I'm updating a set of entities using a HTTP Patch request to a remote backend. The response from the backend includes the updated entities only (i.e., not all entities). I set up my reducer with an entity state adapter and use updateMany to update…
tilo
  • 14,009
  • 6
  • 68
  • 85
7
votes
3 answers

How to normalize deeply nested data with ngrx/entity (EntityState and EntityAdapter)

I wish to normalize data from my server so I can use it more easily with ngrx/entity. I like how ngrx/entity reduces complexity of reducers and other stuff by providing EntityState interface and EntityAdapter. However I don't find it to work good…
Street0
  • 234
  • 3
  • 15
7
votes
2 answers

Using @ngrx/entity, how can I update an items array

I am using @ngrx/entity and this creates a state that looks like the following: { ids: [1, 2, 3], entities: [ 1: {id:1, title: "Some title", likes: {count: 1}}, 2: {id:2, title: "Some title", likes: {count: 1}}, 3: {id:3, title:…
ChrisBratherton
  • 1,540
  • 6
  • 26
  • 63
7
votes
3 answers

how to fix issue when ngrx entity returned undefined for id

why am getting this below error and how to fix this . The entity passed to the selectId implementation returned undefined. You should probably provide your own selectId implementation. The entity that was passed:
Amit Dubey
  • 71
  • 1
  • 3
6
votes
3 answers

The entity passed to the `selectId` implementation returned undefined. You should probably provide your own `selectId` implementation

https://github.com/rokudo5262/phone this is my project i want to load the list of brands in smart table but get the warning i try to fix but the warning is still there please help Brands-features.selector.ts import { createFeatureSelector } from…
TrinhQuangTruong
  • 105
  • 1
  • 11
6
votes
4 answers

@ngrx/entity `Cannot read property 'ids' of undefined` when using together with @ngrx/store? already accounting for custom ids when defining adapter

I have looked at the 2 other posts regarding this, the one with the wrapping around the larger state does not apply whilst the other one with registering multiple forFeature -- I have done some testing around that and even if I import it before or…
SebastianG
  • 8,563
  • 8
  • 47
  • 111
6
votes
2 answers

Cleanest way to replace an entity in collection

Entity Adapter supports updating a collection with the "updateOne" method call. However, when the updated values' keys don't exist this leads to a specific entity not being updated. See code example. However, internally the entity adapter uses…
2manyints
  • 79
  • 2
  • 5
4
votes
0 answers

Update Dictionary in NgRx Entity

I'm trying to update or rather insert new value into dictionary under ngrx Entity. Here is simplified view of Entity: interface Dictionary { [key: number]: T } export class Item { id: number; partsDescriptions:…
rwasik
  • 296
  • 4
  • 17
4
votes
2 answers

Typescript strict mode cannot assign Observable async to primeNg dropdown component

I am using the p-dropdown primeNg component and from what I can see this should be able to take an Observable | async value and use it properly but the Typescript strict mode will not allow this, giving error TS2322: Type 'Customers[] | null is not…
MattE
  • 1,044
  • 1
  • 14
  • 34
4
votes
1 answer

filter in createSelector ngrx with props

I'm trying to create a simple selector to get all the messages in the store by a visitor_id, however, what seems so simple to do is always challenging to achieve in ngrx. I'm using ngrx entity, so I already have the selectAll selector ready, so i…
Yehia A.Salam
  • 1,987
  • 7
  • 44
  • 93
1
2 3
11 12