Skip to content

Commit d384ef2

Browse files
Remove file code fetch if sidebar closed
1 parent f7a38f5 commit d384ef2

4 files changed

Lines changed: 27 additions & 1 deletion

File tree

src/public/dist/bundle.js

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/public/dist/bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/public/js/components/dataBus/store/actions.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ export const setChangedSourceData = payload => ({
1818
});
1919

2020
export const selectNode = fileNode => (dispatch, getState) => {
21+
const { viewSwitches } = getState();
22+
const { checkedState } = viewSwitches;
23+
24+
// TODO: if sidebar opens - fetch code for selected node
25+
if (!checkedState.sideBar) {
26+
return dispatch({
27+
type: ACTIONS.SELECT_NODE,
28+
payload: fileNode
29+
});
30+
}
31+
2132
fetchFile(fileNode.path).then(data =>
2233
dispatch({
2334
type: ACTIONS.SELECT_NODE,

src/server/project-source-watcher.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ const getDirFiles = projectDir => {
2020
throw new Error('There is not files found. Please check source dir and entry point configs.');
2121
}
2222

23+
// TODO: move that code lines to function - sort childrenAlphabetically -
24+
// so you don't need to read code below
25+
// to learn again what it does
2326
treeTraversal(filesTree, node => {
2427
if (node.type === DIR_NODE_TYPE && node.children) {
2528
foldersMap[node.path] = 1;

0 commit comments

Comments
 (0)