summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Slaughter <pslaughter@gitlab.com>2018-06-25 09:54:34 -0500
committerPaul Slaughter <pslaughter@gitlab.com>2018-06-25 11:06:07 -0500
commit52e006999cff80dd0775c9f8d3d08e11518e6385 (patch)
tree438ec48eeda047b8831c1fc119575edf00a4edc9
parent3aa992037abdf3215b58b50f28e495a2f96caf3d (diff)
downloadgitlab-ce-45703-open-web-ide-file-tree.tar.gz
Remove 'visited' check from 'showTreeEntry' action45703-open-web-ide-file-tree
-rw-r--r--app/assets/javascripts/ide/stores/actions/tree.js10
-rw-r--r--spec/javascripts/ide/stores/actions/tree_spec.js19
2 files changed, 5 insertions, 24 deletions
diff --git a/app/assets/javascripts/ide/stores/actions/tree.js b/app/assets/javascripts/ide/stores/actions/tree.js
index 9cc5b3adc9e..2fbc9990fa2 100644
--- a/app/assets/javascripts/ide/stores/actions/tree.js
+++ b/app/assets/javascripts/ide/stores/actions/tree.js
@@ -9,16 +9,14 @@ export const toggleTreeOpen = ({ commit }, path) => {
commit(types.TOGGLE_TREE_OPEN, path);
};
-export const showTreeEntry = ({ commit, dispatch, state }, { path, visited = new Set() }) => {
+export const showTreeEntry = ({ commit, dispatch, state }, path) => {
const entry = state.entries[path];
const parentPath = entry ? entry.parentPath : '';
- if (parentPath && !visited.has(parentPath)) {
- visited.add(parentPath);
-
+ if (parentPath) {
commit(types.SET_TREE_OPEN, parentPath);
- dispatch('showTreeEntry', { path: parentPath, visited });
+ dispatch('showTreeEntry', parentPath);
}
};
@@ -35,7 +33,7 @@ export const handleTreeEntryAction = ({ commit, dispatch }, row) => {
dispatch('getFileData', { path: row.path });
}
- dispatch('showTreeEntry', { path: row.path });
+ dispatch('showTreeEntry', row.path);
};
export const getLastCommitData = ({ state, commit, dispatch }, tree = state) => {
diff --git a/spec/javascripts/ide/stores/actions/tree_spec.js b/spec/javascripts/ide/stores/actions/tree_spec.js
index e8fa95bb970..cefed9ddb43 100644
--- a/spec/javascripts/ide/stores/actions/tree_spec.js
+++ b/spec/javascripts/ide/stores/actions/tree_spec.js
@@ -116,7 +116,7 @@ describe('Multi-file store tree actions', () => {
it('opens the parents', done => {
testAction(
showTreeEntry,
- { path: 'grandparent/parent/child.txt' },
+ 'grandparent/parent/child.txt',
store.state,
[
{ type: types.SET_TREE_OPEN, payload: 'grandparent/parent' },
@@ -128,23 +128,6 @@ describe('Multi-file store tree actions', () => {
done,
);
});
-
- it('stops if there is a loop', done => {
- store.state.entries['grandparent/parent'].parentPath = 'grandparent/parent';
-
- testAction(
- showTreeEntry,
- { path: 'grandparent/parent/child.txt' },
- store.state,
- [
- { type: types.SET_TREE_OPEN, payload: 'grandparent/parent' },
- ],
- [
- { type: 'showTreeEntry' },
- ],
- done,
- );
- });
});
describe('getLastCommitData', () => {