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 {
this.scrollVirtualScrollerToIndex(index);
}
},
async scrollVirtualScrollerToIndex(index) {
scrollVirtualScrollerToIndex(index) {
this.virtualScrollCurrentIndex = index;
await this.$nextTick();
this.virtualScrollCurrentIndex = -1;
},
scrollVirtualScrollerToDiffNote() {
const id = window?.location?.hash;
......@@ -701,7 +697,7 @@ export default {
</dynamic-scroller-item>
</template>
</pre-renderer>
<virtual-scroller-scroll-sync :index="virtualScrollCurrentIndex" />
<virtual-scroller-scroll-sync v-model="virtualScrollCurrentIndex" />
</template>
</dynamic-scroller>
<template v-else>
......
......@@ -2,6 +2,9 @@ import { handleLocationHash } from '~/lib/utils/common_utils';
export default {
inject: ['vscrollParent'],
model: {
prop: 'index',
},
props: {
index: {
type: Number,
......@@ -39,6 +42,7 @@ export default {
methods: {
scrollToIndex(index) {
this.vscrollParent.scrollToItem(index);
this.$emit('update', -1);
setTimeout(() => {
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