Commit 3c0b5030 authored by Phil Hughes's avatar Phil Hughes

Merge branch '337226-lazy-load-commits-unique-key' into 'master'

Use unique key for generating row numbers

See merge request gitlab-org/gitlab!72177
parents e94d3822 c7e11f65
...@@ -90,17 +90,18 @@ export default { ...@@ -90,17 +90,18 @@ export default {
showMore() { showMore() {
this.$emit('showMore'); this.$emit('showMore');
}, },
generateRowNumber(id) { generateRowNumber(path, id, index) {
const key = `${path}-${id}-${index}`;
if (!this.glFeatures.lazyLoadCommits) { if (!this.glFeatures.lazyLoadCommits) {
return 0; return 0;
} }
if (!this.rowNumbers[id] && this.rowNumbers[id] !== 0) { if (!this.rowNumbers[key] && this.rowNumbers[key] !== 0) {
this.$options.totalRowsLoaded += 1; this.$options.totalRowsLoaded += 1;
this.rowNumbers[id] = this.$options.totalRowsLoaded; this.rowNumbers[key] = this.$options.totalRowsLoaded;
} }
return this.rowNumbers[id]; return this.rowNumbers[key];
}, },
getCommit(fileName, type) { getCommit(fileName, type) {
if (!this.glFeatures.lazyLoadCommits) { if (!this.glFeatures.lazyLoadCommits) {
...@@ -150,7 +151,7 @@ export default { ...@@ -150,7 +151,7 @@ export default {
:lfs-oid="entry.lfsOid" :lfs-oid="entry.lfsOid"
:loading-path="loadingPath" :loading-path="loadingPath"
:total-entries="totalEntries" :total-entries="totalEntries"
:row-number="generateRowNumber(entry.id)" :row-number="generateRowNumber(entry.flatPath, entry.id, index)"
:commit-info="getCommit(entry.name, entry.type)" :commit-info="getCommit(entry.name, entry.type)"
v-on="$listeners" v-on="$listeners"
/> />
......
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