Commit cacc8f40 authored by Phil Hughes's avatar Phil Hughes

fixes the sort to correctly order the array

parent e51fde9a
......@@ -24,7 +24,8 @@ export default {
filteredBlobs() {
const searchText = this.searchText.trim();
if (searchText === '') return this.allBlobs.slice(0, MAX_RESULTS);
if (searchText === '')
return this.allBlobs.sort((a, b) => b.lastOpenedAt - a.lastOpenedAt).slice(0, MAX_RESULTS);
return fuzzaldrinPlus.filter(this.allBlobs, searchText, {
key: 'path',
......
......@@ -37,14 +37,12 @@ export const hasChanges = state => !!state.changedFiles.length;
export const hasMergeRequest = state => !!state.currentMergeRequestId;
export const allBlobs = state =>
Object.keys(state.entries)
.reduce((acc, key) => {
const entry = state.entries[key];
Object.keys(state.entries).reduce((acc, key) => {
const entry = state.entries[key];
if (entry.type === 'blob') {
acc.push(entry);
}
if (entry.type === 'blob') {
acc.push(entry);
}
return acc;
}, [])
.sort((a, b) => b.lastOpenedAt > a.lastOpenedAt);
return acc;
}, []);
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