diff options
Diffstat (limited to 'app/assets/javascripts/diffs/components/virtual_scroller_scroll_sync.js')
-rw-r--r-- | app/assets/javascripts/diffs/components/virtual_scroller_scroll_sync.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/app/assets/javascripts/diffs/components/virtual_scroller_scroll_sync.js b/app/assets/javascripts/diffs/components/virtual_scroller_scroll_sync.js index d44dffecc38..fc36153a870 100644 --- a/app/assets/javascripts/diffs/components/virtual_scroller_scroll_sync.js +++ b/app/assets/javascripts/diffs/components/virtual_scroller_scroll_sync.js @@ -18,17 +18,18 @@ export default { if (index < 0) return; - if (this.vscrollParent.itemsWithSize[index].size) { - this.scrollToIndex(index); - } else { + this.scrollToIndex(index); + + if (!this.vscrollParent.itemsWithSize[index].size) { this.$_itemsWithSizeWatcher = this.$watch('vscrollParent.itemsWithSize', async () => { await this.$nextTick(); if (this.vscrollParent.itemsWithSize[index].size) { this.$_itemsWithSizeWatcher(); - this.scrollToIndex(index); await this.$nextTick(); + + this.scrollToIndex(index); } }); } @@ -40,10 +41,12 @@ export default { if (this.$_itemsWithSizeWatcher) this.$_itemsWithSizeWatcher(); }, methods: { - scrollToIndex(index) { + async scrollToIndex(index) { this.vscrollParent.scrollToItem(index); this.$emit('update', -1); + await this.$nextTick(); + setTimeout(() => { handleLocationHash(); }); |