Commit 99dc4430 authored by Phil Hughes's avatar Phil Hughes

improve performance slightly

still has a massive bottleneck somewhere

[ci skip]
parent ea109251
...@@ -5,10 +5,8 @@ import service from '../../services'; ...@@ -5,10 +5,8 @@ import service from '../../services';
import * as types from '../mutation_types'; import * as types from '../mutation_types';
import router from '../../ide_router'; import router from '../../ide_router';
import { import {
setPageTitle,
findEntry, findEntry,
createTemp, createTemp,
createOrMergeEntry,
} from '../utils'; } from '../utils';
import FilesDecoratorWorker from '../workers/files_decorator_worker'; import FilesDecoratorWorker from '../workers/files_decorator_worker';
......
...@@ -17,26 +17,17 @@ export const addedFiles = state => changedFilesMap(state).filter(f => f.tempFile ...@@ -17,26 +17,17 @@ export const addedFiles = state => changedFilesMap(state).filter(f => f.tempFile
export const modifiedFiles = state => changedFilesMap(state).filter(f => !f.tempFile); export const modifiedFiles = state => changedFilesMap(state).filter(f => !f.tempFile);
export const treeList = (state) => { export const treeList = (state) => {
const tree = state.trees['root/testing-123/master']; const tree = state.trees[`${state.currentProjectId}/master`];
if (!tree) return []; if (!tree) return [];
const map = (arr) => { const map = arr => sortTree(arr.tree.map((key) => {
if (!arr.tree.length) return []; const entity = state.entries[key];
return {
return sortTree(arr.tree.reduce((acc, key) => { ...entity,
const entity = state.entries[key]; tree: !arr.tree.length ? [] : map(entity),
};
if (entity) { }));
return acc.concat({
...entity,
tree: map(entity),
});
}
return acc;
}, []));
};
return map(tree); return map(tree);
}; };
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