fix: reset page if skipCount does not change

pull/6605/head
Arman Ozak 5 years ago
parent e3ac63d73b
commit 38b5c4dda5

@ -35,6 +35,7 @@ export class ListService<QueryParamsType = ABP.PageQueryParams> implements OnDes
return this._maxResultCount;
}
private _skipCount = 0;
private _page = 0;
set page(value: number) {
if (value === this._page) return;
@ -81,6 +82,7 @@ export class ListService<QueryParamsType = ABP.PageQueryParams> implements OnDes
}
get = () => {
this.resetPageWhenUnchanged();
this._query$.next(({
filter: this._filter || undefined,
maxResultCount: this._maxResultCount,
@ -110,6 +112,15 @@ export class ListService<QueryParamsType = ABP.PageQueryParams> implements OnDes
ngOnDestroy() {
this.destroy$.next();
}
private resetPageWhenUnchanged() {
const skipCount = this._page * this._maxResultCount;
if (skipCount === this._skipCount) {
this._page = 0;
this._skipCount = 0;
} else this._skipCount = skipCount;
}
}
export type QueryStreamCreatorCallback<T, QueryParamsType = ABP.PageQueryParams> = (

Loading…
Cancel
Save