1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 08:43:33 +00:00

make paging smarter

This commit is contained in:
Kyle Spearrin
2018-04-11 10:34:39 -04:00
parent 744559516d
commit 45033eb81e
2 changed files with 12 additions and 4 deletions

View File

@@ -174,6 +174,10 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
}
loadMore() {
if (this.ciphers.length <= PageSize) {
return;
}
const pagedLength = this.pagedCiphers.length;
if (this.ciphers.length > pagedLength) {
this.pagedCiphers = this.pagedCiphers.concat(this.ciphers.slice(pagedLength, pagedLength + PageSize));
@@ -182,11 +186,15 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
}
isSearching() {
const searching = this.searchText != null && this.searchText.length > 1;
return this.searchText != null && this.searchText.length > 1;
}
isPaging() {
const searching = this.isSearching();
if (searching && this.didScroll) {
this.resetPaging();
}
return searching;
return !searching && this.ciphers.length > PageSize;
}
async resetPaging() {