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
2 answers

ngrx EntityAdapter upsertMany with partial updates

I have an EntityState, let's say of type Model: EntityState. I have an API that is returning a list of partial models. Partial[]. I want to upsert this list. For entities that are already present in the store / entity state (matched by…
Josh G
  • 14,068
  • 7
  • 62
  • 74
2
votes
3 answers

How to display a success message NgRX Effects and dispatch events

reducer: export const reducer = (state = initialstate, action: any) => { switch (action.type) { case ADD_USER: { return { ...state, userAdded: false } }, case ADD_USER_SUCCESS: { return { …
Ramana
  • 1,692
  • 3
  • 18
  • 34
2
votes
1 answer

The entity passed to the `selectId` implementation returned undefined

i want to set token and refresh token in ngrx and save and use that for every request and when the page was reload not delete data in redux . i implementation this state for this : i dispatch data : …
kianoush dortaj
  • 411
  • 7
  • 24
2
votes
1 answer

NgRx-Entity-Selector in loop

I have the following problem. Let's say I have a request to a server, which gives me a list of ids in a specific order. Other calls are loading the entities and I have them in a separate state: So simplified my state is similar to this: { topList:…
trialgod
  • 302
  • 1
  • 15
2
votes
1 answer

How to access ngrx entity selectors in angular lazy-loading module?

I'm trying to implement an application using NGRX state management library.I was able to create action and reducers to push data to lazy-loaded state. But I'm struggling to implement selectors to get data to components. This is what I have done so…
Ajantha Bandara
  • 1,473
  • 15
  • 36
2
votes
2 answers

How to add item to entities in initial state using ngrx

I am using entities and instead of having empty entities at the start I want to add a default item in the initial state. I tried something like below: const id = uuidv4() const zeroState = adapter.getInitialState({ activeTabId: id, }); const…
rainversion_3
  • 887
  • 1
  • 14
  • 30
2
votes
1 answer

ngrx/entity problem with selecting data inside a feature

I'm trying to create a library which has a feature-state and a combined reducer. My feature reducer looks like this: index.ts export const storageFeatureKey = 'storage'; export interface StorageState { [fromBookEntries.bookEntriesFeatureKey]:…
Urastor
  • 91
  • 1
  • 10
2
votes
2 answers

NGRX; How to apply filter on adapter data

I have this piece of code which I want to apply a filter on. The state uses EntityState and Adapter. getAllObjects needs to get categories with parentId of 13 and the getAllTextures gets the remaining. import { Category } from…
amin mohammadi
  • 901
  • 2
  • 15
  • 33
2
votes
1 answer

ngrx entity adapter for a nested property

I have the following store structure for users: usersState = { isLoading: boolean; items: { entities: {}, ids: [] } } adapter.getSelectors() only works for the top level keys, whereas I want to apply it inside the items…
Mister_L
  • 2,469
  • 6
  • 30
  • 64
2
votes
1 answer

Angular ngrx: guards with side-effect

I have guard and now I need to catch error in it from a side-effect which calls an http service and redirects the user to an error state. I tried to add catchError, but I don't even go there if I get an error from server…
hofshteyn
  • 1,272
  • 4
  • 16
  • 33
2
votes
1 answer

Ngrx Entity, how define actions and how properly name actions with effects

I have generated actions using ngrx schematics and It looks like this: export enum UserActionTypes { LoadUsers = '[User] Load Users', AddUser = '[User] Add User', UpsertUser = '[User] Upsert User', AddUsers = '[User] Add Users', …
Adam Adamski
  • 737
  • 3
  • 11
  • 20
2
votes
0 answers

Ngrx and resolvers with HttpClient in Angular 6

I'm using ngrx / (store, effects) in Angular 6. I have the problem in the resolution of one of the routing variables by a resolver. Here the code and the explanation Resolver @Injectable() export class HkSpecialitiesResolver implements…
2
votes
2 answers

How to nest states of lazy-loaded feature modules with @ngrx/store and @ngrx/entity?

I've been struggling for 2 days to compose states of a featureA ("scenarios") module and a nested featureB ("intents") module. Here is the desired structure of my state (structure 1): { authentication: { ... }, router: { ... }, scenarios: { …
paztek
  • 386
  • 3
  • 8
2
votes
1 answer

Using payload of action on ActionsSubject subscription on NGRX

I got the old and bad Property 'payload' does not exist on type 'Action doing this actions subscription: Since is a Creation Action, I need the payload to checkout the userId of the recently created User and navigate to /users/userId BTW: I'm…
Colo Ghidini
  • 658
  • 9
  • 20
2
votes
1 answer

creating @ngrx selector with data from multiple entities (Angular)

I have @ngrx entities based on following models: export interface Product { id: number; code: string; text: string; brand: any; quantity_available: number; rate: number; // ... other variables } export interface BasketProduct { id:…
1 2
3
11 12