Commit ba4dde7c authored by Phil Hughes's avatar Phil Hughes

small performance improvement by caching the computed prop

fixed eslint

there are still some performance issues with larger lists. Need to
investigate whether this is a Vue issue or a fuzzaldrin issue
parent d32eaee2
...@@ -31,13 +31,16 @@ export default { ...@@ -31,13 +31,16 @@ export default {
maxResults: MAX_RESULTS, maxResults: MAX_RESULTS,
}); });
}, },
filteredBlobsLength() {
return this.filteredBlobs.length;
},
listShowCount() { listShowCount() {
if (!this.filteredBlobs.length) return 1; if (!this.filteredBlobsLength) return 1;
return this.filteredBlobs.length > 5 ? 5 : this.filteredBlobs.length; return this.filteredBlobsLength > 5 ? 5 : this.filteredBlobsLength;
}, },
listHeight() { listHeight() {
return this.filteredBlobs.length ? 55 : 33; return this.filteredBlobsLength ? 55 : 33;
}, },
}, },
watch: { watch: {
...@@ -62,7 +65,7 @@ export default { ...@@ -62,7 +65,7 @@ export default {
case 40: case 40:
// DOWN // DOWN
e.preventDefault(); e.preventDefault();
if (this.focusedIndex < this.filteredBlobs.length - 1) this.focusedIndex += 1; if (this.focusedIndex < this.filteredBlobsLength - 1) this.focusedIndex += 1;
break; break;
default: default:
break; break;
...@@ -117,7 +120,7 @@ export default { ...@@ -117,7 +120,7 @@ export default {
:start="focusedIndex" :start="focusedIndex"
wtag="ul" wtag="ul"
> >
<template v-if="filteredBlobs.length"> <template v-if="filteredBlobsLength">
<li <li
v-for="(file, index) in filteredBlobs" v-for="(file, index) in filteredBlobs"
:key="file.key" :key="file.key"
......
...@@ -56,12 +56,12 @@ export default { ...@@ -56,12 +56,12 @@ export default {
<span class="diff-changed-file-content append-right-8"> <span class="diff-changed-file-content append-right-8">
<strong <strong
class="diff-changed-file-name" class="diff-changed-file-name"
v-html="highlightText(this.file.name)" v-html="highlightText(file.name)"
> >
</strong> </strong>
<span <span
class="diff-changed-file-path prepend-top-5" class="diff-changed-file-path prepend-top-5"
v-html="highlightText(this.file.path)" v-html="highlightText(file.path)"
> >
</span> </span>
</span> </span>
......
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