Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
894b6fe1
Commit
894b6fe1
authored
Jun 17, 2021
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a bug where the index would be incorrect
parent
6783350d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
13 deletions
+14
-13
app/assets/javascripts/diffs/components/virtual_scroller_scroll_sync.js
...ascripts/diffs/components/virtual_scroller_scroll_sync.js
+9
-7
app/assets/javascripts/diffs/store/actions.js
app/assets/javascripts/diffs/store/actions.js
+5
-6
No files found.
app/assets/javascripts/diffs/components/virtual_scroller_scroll_sync.js
View file @
894b6fe1
...
@@ -9,17 +9,19 @@ export default {
...
@@ -9,17 +9,19 @@ export default {
watch
:
{
watch
:
{
index
:
{
index
:
{
handler
()
{
handler
()
{
if
(
this
.
index
<
0
)
return
;
const
{
index
}
=
this
;
if
(
this
.
vscrollParent
.
itemsWithSize
[
this
.
index
].
size
)
{
if
(
index
<
0
)
return
;
this
.
scrollToIndex
();
if
(
this
.
vscrollParent
.
itemsWithSize
[
index
].
size
)
{
this
.
scrollToIndex
(
index
);
}
else
{
}
else
{
this
.
$_itemsWithSizeWatcher
=
this
.
$watch
(
'
vscrollParent.itemsWithSize
'
,
async
()
=>
{
this
.
$_itemsWithSizeWatcher
=
this
.
$watch
(
'
vscrollParent.itemsWithSize
'
,
async
()
=>
{
await
this
.
$nextTick
();
await
this
.
$nextTick
();
if
(
this
.
vscrollParent
.
itemsWithSize
[
this
.
index
].
size
)
{
if
(
this
.
vscrollParent
.
itemsWithSize
[
index
].
size
)
{
this
.
$_itemsWithSizeWatcher
();
this
.
$_itemsWithSizeWatcher
();
this
.
scrollToIndex
();
this
.
scrollToIndex
(
index
);
}
}
});
});
}
}
...
@@ -31,8 +33,8 @@ export default {
...
@@ -31,8 +33,8 @@ export default {
if
(
this
.
$_itemsWithSizeWatcher
)
this
.
$_itemsWithSizeWatcher
();
if
(
this
.
$_itemsWithSizeWatcher
)
this
.
$_itemsWithSizeWatcher
();
},
},
methods
:
{
methods
:
{
scrollToIndex
()
{
scrollToIndex
(
index
)
{
this
.
vscrollParent
.
scrollToItem
(
this
.
index
);
this
.
vscrollParent
.
scrollToItem
(
index
);
},
},
},
},
render
(
h
)
{
render
(
h
)
{
...
...
app/assets/javascripts/diffs/store/actions.js
View file @
894b6fe1
...
@@ -125,6 +125,11 @@ export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => {
...
@@ -125,6 +125,11 @@ export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => {
commit
(
types
.
SET_DIFF_DATA_BATCH
,
{
diff_files
});
commit
(
types
.
SET_DIFF_DATA_BATCH
,
{
diff_files
});
commit
(
types
.
SET_BATCH_LOADING
,
false
);
commit
(
types
.
SET_BATCH_LOADING
,
false
);
eventHub
.
$emit
(
'
scrollToFileHash
'
,
window
.
location
.
hash
.
replace
(
'
#
'
,
''
).
split
(
'
diff-content-
'
).
pop
(),
);
if
(
!
isNoteLink
&&
!
state
.
currentDiffFileId
)
{
if
(
!
isNoteLink
&&
!
state
.
currentDiffFileId
)
{
commit
(
types
.
VIEW_DIFF_FILE
,
diff_files
[
0
].
file_hash
);
commit
(
types
.
VIEW_DIFF_FILE
,
diff_files
[
0
].
file_hash
);
}
}
...
@@ -190,12 +195,6 @@ export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => {
...
@@ -190,12 +195,6 @@ export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => {
return
getBatch
()
return
getBatch
()
.
then
(()
=>
!
window
.
gon
?.
features
?.
diffsVirtualScrolling
&&
handleLocationHash
())
.
then
(()
=>
!
window
.
gon
?.
features
?.
diffsVirtualScrolling
&&
handleLocationHash
())
.
then
(()
=>
{
eventHub
.
$emit
(
'
scrollToFileHash
'
,
window
.
location
.
hash
.
replace
(
'
#
'
,
''
).
split
(
'
diff-content-
'
).
pop
(),
);
})
.
catch
(()
=>
null
);
.
catch
(()
=>
null
);
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment