diff --git a/client/components/Nav.js b/client/components/Nav.js
index 87ef80ec..d7862bec 100644
--- a/client/components/Nav.js
+++ b/client/components/Nav.js
@@ -8,7 +8,7 @@ function Nav(props) {
New
@@ -50,7 +50,7 @@ function Nav(props) {
}
Nav.propTypes = {
- createProject: PropTypes.func.isRequired,
+ newProject: PropTypes.func.isRequired,
saveProject: PropTypes.func.isRequired,
exportProjectAsZip: PropTypes.func.isRequired,
cloneProject: PropTypes.func.isRequired,
diff --git a/client/constants.js b/client/constants.js
index 00061bf1..29f60645 100644
--- a/client/constants.js
+++ b/client/constants.js
@@ -26,6 +26,7 @@ export const SET_PROJECT_NAME = 'SET_PROJECT_NAME';
export const PROJECT_SAVE_SUCCESS = 'PROJECT_SAVE_SUCCESS';
export const PROJECT_SAVE_FAIL = 'PROJECT_SAVE_FAIL';
export const NEW_PROJECT = 'NEW_PROJECT';
+export const RESET_PROJECT = 'RESET_PROJECT';
export const SET_PROJECT = 'SET_PROJECT';
export const SET_PROJECTS = 'SET_PROJECTS';
diff --git a/client/modules/IDE/actions/project.js b/client/modules/IDE/actions/project.js
index d44cf12a..3737b968 100644
--- a/client/modules/IDE/actions/project.js
+++ b/client/modules/IDE/actions/project.js
@@ -116,7 +116,6 @@ export function createProject() {
export function exportProjectAsZip() {
return (dispatch, getState) => {
- console.log('exporting project!');
const state = getState();
const zip = new JSZip();
async.each(state.files, (file, cb) => {
@@ -139,6 +138,13 @@ export function exportProjectAsZip() {
};
}
+export function newProject() {
+ browserHistory.push('/');
+ return {
+ type: ActionTypes.RESET_PROJECT
+ };
+}
+
export function cloneProject() {
return (dispatch, getState) => {
const state = getState();
diff --git a/client/modules/IDE/components/Editor.js b/client/modules/IDE/components/Editor.js
index a7f5ab5e..8e734b78 100644
--- a/client/modules/IDE/components/Editor.js
+++ b/client/modules/IDE/components/Editor.js
@@ -70,6 +70,8 @@ class Editor extends React.Component {
this._cm.setOption('mode', 'htmlmixed');
}
}
+
+ console.log('componentDidUpdate in editor');
}
componentWillUnmount() {
diff --git a/client/modules/IDE/pages/IDEView.js b/client/modules/IDE/pages/IDEView.js
index a6c4b7c9..5fc80c91 100644
--- a/client/modules/IDE/pages/IDEView.js
+++ b/client/modules/IDE/pages/IDEView.js
@@ -38,6 +38,7 @@ class IDEView extends React.Component {
this.consoleSize = this.props.ide.consoleIsExpanded ? 180 : 29;
this.sidebarSize = this.props.ide.sidebarIsExpanded ? 180 : 20;
+ this.forceUpdate();
}
componentWillUpdate(nextProps) {
@@ -65,11 +66,18 @@ class IDEView extends React.Component {
this.autosaveInterval = null;
}
}
+
+ if (this.autosaveInterval && !this.props.project.id) {
+ clearInterval(this.autosaveInterval);
+ this.autosaveInterval = null;
+ }
}
componentWillUnmount() {
clearInterval(this.autosaveInterval);
this.autosaveInterval = null;
+ this.consoleSize = undefined;
+ this.sidebarSize = undefined;
}
_handleConsolePaneOnDragFinished() {
@@ -81,6 +89,7 @@ class IDEView extends React.Component {
}
_handleSidebarPaneOnDragFinished() {
+ console.log('setting sidebar size');
this.sidebarSize = this.refs.sidebarPane.state.draggedSize;
this.refs.sidebarPane.setState({
resized: false,
@@ -93,7 +102,7 @@ class IDEView extends React.Component {