mirror of
https://github.com/nextcloud/server.git
synced 2026-03-04 06:21:07 -05:00
Prevent infinite loop in search auto-nextpage
When loading the next page of search results, make sure that the loop
can end if there are no more elements in case the total doesn't match.
Also added a check to avoid recomputing the search results whenever the
setFilter() is called with the same value. This happens when navigating
away to another folder, the search field gets cleared automatically and
it calls FileList.setFilter('').
This commit is contained in:
parent
1b9fa4dd5f
commit
5cfbb9624f
1 changed files with 5 additions and 2 deletions
|
|
@ -2352,13 +2352,16 @@
|
|||
*/
|
||||
setFilter:function(filter) {
|
||||
var total = 0;
|
||||
if (this._filter === filter) {
|
||||
return;
|
||||
}
|
||||
this._filter = filter;
|
||||
this.fileSummary.setFilter(filter, this.files);
|
||||
total = this.fileSummary.getTotal();
|
||||
if (!this.$el.find('.mask').exists()) {
|
||||
this.hideIrrelevantUIWhenNoFilesMatch();
|
||||
}
|
||||
var that = this;
|
||||
|
||||
var visibleCount = 0;
|
||||
filter = filter.toLowerCase();
|
||||
|
||||
|
|
@ -2378,7 +2381,7 @@
|
|||
if (visibleCount < total) {
|
||||
$trs = this._nextPage(false);
|
||||
}
|
||||
} while (visibleCount < total);
|
||||
} while (visibleCount < total && $trs.length > 0);
|
||||
|
||||
this.$container.trigger('scroll');
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue