summaryrefslogtreecommitdiffstats
path: root/apps/files/src/components/VirtualList.vue
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/src/components/VirtualList.vue')
-rw-r--r--apps/files/src/components/VirtualList.vue5
1 files changed, 5 insertions, 0 deletions
diff --git a/apps/files/src/components/VirtualList.vue b/apps/files/src/components/VirtualList.vue
index d6508df1032..173fe284d27 100644
--- a/apps/files/src/components/VirtualList.vue
+++ b/apps/files/src/components/VirtualList.vue
@@ -243,6 +243,11 @@ export default Vue.extend({
methods: {
scrollTo(index: number) {
+ const targetRow = Math.ceil(this.dataSources.length / this.columnCount)
+ if (targetRow < this.rowCount) {
+ logger.debug('VirtualList: Skip scrolling. nothing to scroll', { index, targetRow, rowCount: this.rowCount })
+ return
+ }
this.index = index
// Scroll to one row and a half before the index
const scrollTop = (Math.floor(index / this.columnCount) - 0.5) * this.itemHeight + this.beforeHeight