Error: node_modules/@ngrx/effects/src/concat_latest_from.d.ts:2:145 - error TS2574: A rest element type must be an array type.
export declare function concatLatestFrom<T extends Observable<unknown>[], V>(observablesFactory: (value: V) => [...T]): OperatorFunction<V, [V, ...{
[i in keyof T]: ObservedValueOf<T[i]>;
}]>;
still active community here? question about entityAdapter,
it seems like deeper object key data is overwritten completely instead of concat, what i would expect.
if this is my entity:
'93dd0fd6-fd8c-4c70-a213-cb76d1ef6eda': {
guid: '93dd0fd6-fd8c-4c70-a213-cb76d1ef6eda',
languageSettings: {
DE: {
slug: 'velows',
},
EN: {
slug: 'velows',
},
FR: {
slug: 'velows',
},
NL: {
slug: 'veluwe',
},
},
},
and i update the object with a specific language for content like
```
'93dd0fd6-fd8c-4c70-a213-cb76d1ef6eda': {
guid: '93dd0fd6-fd8c-4c70-a213-cb76d1ef6eda',
languageSettings: {
EN: {
slug: 'velows',
title: 'Testing EN',
content: 'Test',
},
},
},
How do i concat with the entityAdapter?
export const selectConnectedAccount = (state: AppState) => state.login
ngOnInit() {
this.store
.pipe(
map(state => {
console.log('mapping state header: ', state)
return selectConnectedAccount(state);
}),
filter(val => val !== undefined),
filter((val: any) => val.currentAccount !== undefined),
// distinctUntilChanged
)
.subscribe(
state => {
if (state.currentAccount) {
console.log('got new connected address: ', state)
this.connectedAddress = state.currentAccount;
// Uncommenting below line causes infinite loop of ngrx actions firing...
// this.store.dispatch(loadHydrants({ account: this.connectedAddress }))
console.log('got address, dispatching call for hydrants... ', this.connectedAddress)
}
else
console.log('got empty state: ', state)
}
)
}
export interface AppState {
login: any;
hydrants: any;
}
i'm using angular 12 + ngrx 12.2 + router-store. i have a ItemListComponent that shows a list of items and ItemDetailsComponent that shows details about one item. if i go to the list component and get the list of all items and then from there router.navigate to the Details component e.g. /itemDetails/1
everything works fine using <div *ngIf="item$ | async as item"
however, if i navigate directly to the /itemDetails/1
the item details don't show up. in my facade, i have
selectedItems$ = this.store
.pipe(select(ItemsSelectors.getSelected))
.pipe(
tap(project => {
if (!project) {
this.loadAllItems();
}
}),
filter(project => {
console.log('item: ', item);
return item !== undefined;
})
);
i can see it logging the empty item before it pulls the list and the item with data after
@derekkite, @RoboZoom
Trying to implement @ngrx/entity for the first time. Getting the below error.
core.js:4442 ERROR TypeError: entities is not iterable
at addManyMutably (http://localhost:4200/vendor.js:126898:30)
at setAllMutably (http://localhost:4200/vendor.js:126911:9)
at Object.operation [as setAll] (http://localhost:4200/vendor.js:126833:27)
at http://localhost:4200/main.js:731:88
at http://localhost:4200/vendor.js:235769:26
at combination (http://localhost:4200/vendor.js:234089:37)
at onboardingReducer (http://localhost:4200/main.js:680:12)
at http://localhost:4200/vendor.js:234201:20
at combination (http://localhost:4200/vendor.js:234089:37)
at http://localhost:4200/vendor.js:234986:27
Below is my code snippet.
---Model---
export interface DataPayload {id: string; name: string;address: string; }
--Action--
export const getDataAction = createAction('[Get Data] Get data');
export const getDataSuccessAction = createAction('[Get Data] Get data successfully', props<{ data: DataPayload[] }>());
---Reducer---
export interface DataState extends EntityState<DataPayload> {}
export const DataAdapter: EntityAdapter<DataPayload> = createEntityAdapter<DataPayload>({selectId: (data: DataPayload) => data.id});
export const initialDataState: RefCountryState = refCountryAdapter.getInitialState({});
export const dataReducer = createReducer(
initialDataState,
on(getReferenceCountrySuccessAction, (state, action) => {
return refCountryAdapter.setAll(action.refCountries, state);
}));
---Effects---
getData$ = createEffect(() =>
this.actions$.pipe(ofType(getDataAction),
mergeMap(() => this.dataService.getData().pipe(
map((response) => {
console.log(response); // Here I am getting the data back as an array - {data: Array(14)}
return getDataSuccessAction( {refCountries});
})))));
Any help would be appreciated.
Thanks