From b0ce13e6bae2d852df4c090912e16204b59a1f28 Mon Sep 17 00:00:00 2001 From: catarak Date: Wed, 24 Aug 2016 15:29:58 -0400 Subject: [PATCH] fix project loading bug --- client/modules/IDE/components/FileNode.js | 2 +- client/modules/IDE/components/Sidebar.js | 2 +- client/modules/IDE/reducers/files.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/modules/IDE/components/FileNode.js b/client/modules/IDE/components/FileNode.js index 009a893c..f6f0f4c4 100644 --- a/client/modules/IDE/components/FileNode.js +++ b/client/modules/IDE/components/FileNode.js @@ -151,7 +151,7 @@ FileNode.propTypes = { }; function mapStateToProps(state, ownProps) { - return state.files.find((file) => file.id === ownProps.id); + return state.files.find((file) => file.id === ownProps.id) || { ...ownProps, name: 'test' }; } function mapDispatchToProps(dispatch) { diff --git a/client/modules/IDE/components/Sidebar.js b/client/modules/IDE/components/Sidebar.js index 733fe426..cb9a0153 100644 --- a/client/modules/IDE/components/Sidebar.js +++ b/client/modules/IDE/components/Sidebar.js @@ -1,7 +1,7 @@ import React, { PropTypes } from 'react'; import classNames from 'classnames'; import InlineSVG from 'react-inlinesvg'; -import SidebarItem from './SidebarItem'; +// import SidebarItem from './SidebarItem'; const rightArrowUrl = require('../../../images/right-arrow.svg'); const leftArrowUrl = require('../../../images/left-arrow.svg'); import ConnectedFileNode from './FileNode'; diff --git a/client/modules/IDE/reducers/files.js b/client/modules/IDE/reducers/files.js index 4381e1e0..ea3cdcf8 100644 --- a/client/modules/IDE/reducers/files.js +++ b/client/modules/IDE/reducers/files.js @@ -100,7 +100,7 @@ const files = (state, action) => { } return file; }); - return [...newState, { name: action.name, id: action.id, content: action.content, url: action.url }]; + return [...newState, { name: action.name, id: action.id, _id: action._id, content: action.content, url: action.url }]; case ActionTypes.SHOW_FILE_OPTIONS: return state.map(file => { if (file.id !== action.id) {