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