diff --git a/npm/ng-packs/packages/core/src/lib/services/list.service.ts b/npm/ng-packs/packages/core/src/lib/services/list.service.ts index 1a1e7c1aeb..375e1c7bcf 100644 --- a/npm/ng-packs/packages/core/src/lib/services/list.service.ts +++ b/npm/ng-packs/packages/core/src/lib/services/list.service.ts @@ -35,6 +35,7 @@ export class ListService 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 implements OnDes } get = () => { + this.resetPageWhenUnchanged(); this._query$.next(({ filter: this._filter || undefined, maxResultCount: this._maxResultCount, @@ -110,6 +112,15 @@ export class ListService 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 = (