Apologies if this has been asked before. I am struggling to find a solution for my current issue.
I am trying to make my store state more complex using ngrx/entity, but I am having trouble implementing it correctly.
Below are the models in my reducer:
export interface State extends EntityState<BagParametres> {
SimpleBag: BagParametres;
}
export const adapter: EntityAdapter<BagParametres> = createEntityAdapter<BagParametres>({
selectId: (params: BagParametres) => params.id
});
export const initialState: State = adapter.getInitialState({
SimpleBag: defaultParams,
RareBags: {
ids: [],
entities: []
}
});
The expected store structure:
{
SimpleBag: {
//params
},
RareBags: {
ids: [2, 3, 4 //, ...etc],
entities: [
{ id: 2 //, etc params },
{ id: 3 //, etc params },
{ id: 4 //, etc params }
// ... and so on
]
}
}
The current store structure I am getting:
{
SimpleBag: {
id: 1
// etc params
},,
RareBags: {
ids: [],
entities: []
},
ids: [2, 3, 4 //, ...etc],
entities: [
{ id: 2 //, etc params },
{ id: 3 //, etc params },
{ id: 4 //, etc params }
// ... and so on
]
}
Can someone guide me on how to place 'ids' and 'entities' inside 'RareBags'?