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

Why does deep cloning my state cause ngrx to go into an infinite loop, constantly calling my reducer?

We had the following ngrx reducer, but added a nested object to our state (structure: settings: { a: boolean, b: string }), so decided to use lodash’s cloneDeep(obj) instead of the ...obj spread operator to ensure our state is immutable, as per the…
Christian
  • 6,070
  • 11
  • 53
  • 103
0
votes
1 answer

Asserting NGRX Dictionary value is defined

I've just upgraded from Angular 7.1.4 to 8.2.0, Typescript 3.1.6 to 3.5.3, RxJS Before the upgrade, TS correctly identified that this array item is not undefined, but now I'm getting this frustrating compilation error. (note, I'm using lo-dash…
HankScorpio
  • 3,612
  • 15
  • 27
0
votes
1 answer

NGRX Entity addOne replaces object in current state

I am trying to perform insert operation and I am following this article https://angularfirebase.com/lessons/ngrx-entity-feature-modules-tutorial/ Unfortunately instead of adding new object to current state previous one is replaced by new one. Can…
Mateusz Gebroski
  • 1,274
  • 3
  • 26
  • 57
0
votes
0 answers

@ngrx/entity EntityAdapter Functions for Reducer do not Change Store State

So I have a custom entity, which I will add to in the UI: meeting.ts: export interface Meeting { summary: MeetingSummary; agenda: any; audience?: Audience[]; venue?: { lat?: number; long?: number; }; invitationKey?: string; …
thomi
  • 1,603
  • 1
  • 24
  • 31
0
votes
1 answer

In ngrx entity please tell me what type is in EntityState

I just want to find what this type for EntityState is. I just put the above in as code so that the V part shows up...( and I have no freaking idea how to search for something that is enclosed in chevrons or wtf those things are called) I've…
Leo Ku
  • 73
  • 2
  • 6
0
votes
1 answer

A action is seemingly overwriting another unrelated slice

I'm not quite sure how to explain this, but here is a picture that could help explain the issue that I seem to be facing. As you can see, I have a SharedNotificationsModule and a SharedConversationsModule, these are totally separate to one another…
ChrisBratherton
  • 1,540
  • 6
  • 26
  • 63
0
votes
1 answer

Addtional parameter with @ngrx/entity

I want to keep employee array and page loading status in store state. So my initial state will look like this const initialState = { isLoading: false, employees: [] }; Now i want to use @ngrx/entity for employee instead of array. The…
Ravin Singh D
  • 904
  • 10
  • 19
0
votes
1 answer

NGRX entity with store containing only a subset of records

Recently made a component with state management using NGRX entity, where previously we have used straight up NGRX action->reducer->effect->selector. From first impressions it seems to me that the design pattern expects you to load the total record…
ldgorman
  • 1,553
  • 1
  • 14
  • 39
0
votes
1 answer

Receiving an array with a specific key using ngrx/selector and ngrx/entities

How can I use the selector to get data only with a certain key? That is, I have 4 menus, each with a specific catalogCode, the user gets a list for a specific menu from the server on click. Each element of this list has an id = code + catalogCode.…
user10990607
0
votes
1 answer

NGRX Can't read entities parameters

I'm attempting to set up an application that uses NGRX. I'm having difficulties with accessing returned Entity parameters when a single entity is supposed to be loaded. I'm also having troubles loading the Entity in a modal form due to not being…
0
votes
1 answer

Can I use single EntityAdapter for a few instance of the same EntityState?

I have a one EntityStates of the same model assigned to a few properties in the single state. Can I manipulate all of them using a single adapter? They have the same initial state but will contain values with various status. interface myState { …
Stefan
  • 1,431
  • 2
  • 17
  • 33
0
votes
1 answer

NGRX: Composing state when we have to represent data from two lists

Practical example: Consider an expand/collapse list. Each item expands another list. export interface MainDomainList { id: number name: string; } export interface SubDomainList { id: number name: string; } export interface AppState { …
userdac
  • 48
  • 7
0
votes
1 answer

Memoized selector with computation in @ngrx/store

My normalized ngrx store looks like this: export interface State { carts: EntityState; items: EntityState; } export interface Cart { id: number; maxVolume: number; } export interface Item { id: number; cartId:…
Ante Novokmet
  • 388
  • 3
  • 13
0
votes
1 answer

Angular ngrx: check is field exists in object

I'm sorry if it's a duplication of any question, however, I can't find a solution to my problem. I have a selector that getting a big object with a big nesting. And I need to return some value from it. How can I check is fields exist to prevent…
hofshteyn
  • 1,272
  • 4
  • 16
  • 33
0
votes
1 answer

NGRX entity: How to assign action.payload to state property in UpsertOne

I have a reducer in entity state. How do I assign action.payload.Message to saveMessage.msg while performing upsertOne on UPSERT_Message_SUCCESS action. export interface MessageState extends EntityState { // additional entities state…
prabhat gundepalli
  • 907
  • 3
  • 15
  • 39
1 2 3
11
12