Commit 0c57267a authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch 'slashmanov/fix-mr-diffs-scroll-to-hash' into 'master'

Fix scrolling to hash in MR diffs app

See merge request gitlab-org/gitlab!84941
parents 6e4c079d bed3c946
...@@ -570,12 +570,8 @@ export default { ...@@ -570,12 +570,8 @@ export default {
this.scrollVirtualScrollerToIndex(index); this.scrollVirtualScrollerToIndex(index);
} }
}, },
async scrollVirtualScrollerToIndex(index) { scrollVirtualScrollerToIndex(index) {
this.virtualScrollCurrentIndex = index; this.virtualScrollCurrentIndex = index;
await this.$nextTick();
this.virtualScrollCurrentIndex = -1;
}, },
scrollVirtualScrollerToDiffNote() { scrollVirtualScrollerToDiffNote() {
const id = window?.location?.hash; const id = window?.location?.hash;
...@@ -701,7 +697,7 @@ export default { ...@@ -701,7 +697,7 @@ export default {
</dynamic-scroller-item> </dynamic-scroller-item>
</template> </template>
</pre-renderer> </pre-renderer>
<virtual-scroller-scroll-sync :index="virtualScrollCurrentIndex" /> <virtual-scroller-scroll-sync v-model="virtualScrollCurrentIndex" />
</template> </template>
</dynamic-scroller> </dynamic-scroller>
<template v-else> <template v-else>
......
...@@ -2,6 +2,9 @@ import { handleLocationHash } from '~/lib/utils/common_utils'; ...@@ -2,6 +2,9 @@ import { handleLocationHash } from '~/lib/utils/common_utils';
export default { export default {
inject: ['vscrollParent'], inject: ['vscrollParent'],
model: {
prop: 'index',
},
props: { props: {
index: { index: {
type: Number, type: Number,
...@@ -39,6 +42,7 @@ export default { ...@@ -39,6 +42,7 @@ export default {
methods: { methods: {
scrollToIndex(index) { scrollToIndex(index) {
this.vscrollParent.scrollToItem(index); this.vscrollParent.scrollToItem(index);
this.$emit('update', -1);
setTimeout(() => { setTimeout(() => {
handleLocationHash(); handleLocationHash();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment