Skip to content

Commit

Permalink
issue-276 get rid of Datasource.reset call on destroy (vscroll v1.2.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhilt committed Jul 14, 2021
1 parent a0a3212 commit 3698d77
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package-dist.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"dependencies": {
"tslib": "^1.9.0",
"vscroll": "^1.2.0-beta"
"vscroll": "^1.2.0"
},
"keywords": [
"angular",
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"ngx-bootstrap": "^5.6.1",
"rxjs": "~6.6.1",
"tslib": "^1.13.0",
"vscroll": "^1.2.0-beta",
"vscroll": "^1.2.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
Expand Down
4 changes: 0 additions & 4 deletions src/ui-scroll.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,5 @@ export class UiScrollComponent<Data = unknown> implements OnInit, OnDestroy {

ngOnDestroy(): void {
this.workflow.dispose();
const { reset } = (this.datasource as unknown as { reset?: () => void });
if (typeof reset === 'function') {
reset.call(this.datasource);
}
}
}
5 changes: 2 additions & 3 deletions tests/adapter.reload.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,11 @@ const shouldReloadOnFirstVisibleChange: ItFuncConfig<ICustom> = config => misc =
lastCycle = misc.workflow.cyclesDone + 1;
}
});
misc.adapter.isLoading$.pipe(filter(v => !v)).subscribe(() => {
const sub2 = misc.adapter.isLoading$.pipe(filter(v => !v)).subscribe(() => {
if (!stopScroll) {
misc.scrollMin();
} else if (misc.workflow.cyclesDone === lastCycle) {
sub2.unsubscribe();
checkExpectation(config, misc);
done();
}
Expand All @@ -303,8 +304,6 @@ const shouldReloadOnFirstVisibleChange: ItFuncConfig<ICustom> = config => misc =

describe('Adapter Reload Spec', () => {

// configListDestructiveFilter(configList, 0);

describe('simple reload', () =>
configList.forEach(config =>
makeTest({
Expand Down

0 comments on commit 3698d77

Please sign in to comment.