Commit 02a5462b authored by Lukas 'Eipi' Eipert's avatar Lukas 'Eipi' Eipert Committed by Phil Hughes

Only render FileFinderOverlay when needed

parent 5226c013
...@@ -50,9 +50,6 @@ export default function initDiffsApp(store) { ...@@ -50,9 +50,6 @@ export default function initDiffsApp(store) {
click: this.openFile, click: this.openFile,
}, },
class: ['diff-file-finder'], class: ['diff-file-finder'],
style: {
display: this.fileFinderVisible ? '' : 'none',
},
}); });
}, },
}); });
......
...@@ -130,7 +130,6 @@ export default { ...@@ -130,7 +130,6 @@ export default {
<div class="ide-view flex-grow d-flex"> <div class="ide-view flex-grow d-flex">
<template v-if="loadDeferred"> <template v-if="loadDeferred">
<find-file <find-file
v-show="fileFindVisible"
:files="allBlobs" :files="allBlobs"
:visible="fileFindVisible" :visible="fileFindVisible"
:loading="loading" :loading="loading"
......
...@@ -103,6 +103,9 @@ export default { ...@@ -103,6 +103,9 @@ export default {
focusedIndex() { focusedIndex() {
if (!this.mouseOver) { if (!this.mouseOver) {
this.$nextTick(() => { this.$nextTick(() => {
if (!this.$refs.virtualScrollList?.$el) {
return;
}
const el = this.$refs.virtualScrollList.$el; const el = this.$refs.virtualScrollList.$el;
const scrollTop = this.focusedIndex * FILE_FINDER_ROW_HEIGHT; const scrollTop = this.focusedIndex * FILE_FINDER_ROW_HEIGHT;
const bottom = this.listShowCount * FILE_FINDER_ROW_HEIGHT; const bottom = this.listShowCount * FILE_FINDER_ROW_HEIGHT;
...@@ -218,7 +221,7 @@ export default { ...@@ -218,7 +221,7 @@ export default {
</script> </script>
<template> <template>
<div class="file-finder-overlay" @mousedown.self="toggle(false)"> <div v-if="visible" class="file-finder-overlay" @mousedown.self="toggle(false)">
<div class="dropdown-menu diff-file-changes file-finder show"> <div class="dropdown-menu diff-file-changes file-finder show">
<div :class="{ 'has-value': showClearInputButton }" class="dropdown-input"> <div :class="{ 'has-value': showClearInputButton }" class="dropdown-input">
<input <input
......
...@@ -154,6 +154,16 @@ describe('File finder item spec', () => { ...@@ -154,6 +154,16 @@ describe('File finder item spec', () => {
}); });
}); });
describe('DOM Performance', () => {
it('renders less DOM nodes if not visible by utilizing v-if', async () => {
vm.visible = false;
await waitForPromises();
expect(vm.$el).toBeInstanceOf(Comment);
});
});
describe('watches', () => { describe('watches', () => {
describe('searchText', () => { describe('searchText', () => {
it('resets focusedIndex when updated', (done) => { it('resets focusedIndex when updated', (done) => {
...@@ -169,7 +179,7 @@ describe('File finder item spec', () => { ...@@ -169,7 +179,7 @@ describe('File finder item spec', () => {
}); });
describe('visible', () => { describe('visible', () => {
it('returns searchText when false', (done) => { it('resets searchText when changed to false', (done) => {
vm.searchText = 'test'; vm.searchText = 'test';
vm.visible = true; vm.visible = true;
......
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