Как использовать метод загрузки DataSource с хранилищем ngrx?
У меня есть следующие проблемы: 1. При загрузке страницы вызывается метод загрузки 2. Бесконечная загрузка 3. 2 запроса отправляются на сервер вместо1
Если я воспользуюсь услугой напрямую, проблем не будет.
Машинопись:
this.ds = new CustomStore({
load: (loadOptions: any) => {
this.myFacade.loadAllRecords(this.filter, loadOptions);
return this.myFacade.records$
.toPromise()
.then(result => {
return result;
});
}
});

this.ds = new CustomStore({
load: (loadOptions: any) => {
this.myFacade.loadAllRecords(this.filter, loadOptions);
return new Promise(resolve => this.myFacade.records$
.pipe(takeUntil(this.unsubscribe$)).subscribe(resolve)).then(result => {
return result;
});
}
});


export class MyFacade {
public records$: Observable<any>;
constructor(private store: Store<State>) {
this.records$ =
this.store.pipe(select(myQuery.getRecords));
}
loadAllRecords(model: myModel, loadOptions?: LoadOptions) {
this.store.dispatch(new LoadRecords(model, loadOptions));
}
}