diff --git a/client/modules/IDE/pages/IDEView.js b/client/modules/IDE/pages/IDEView.js index 9a8cf29e..29e3aa36 100644 --- a/client/modules/IDE/pages/IDEView.js +++ b/client/modules/IDE/pages/IDEView.js @@ -25,6 +25,12 @@ class IDEView extends React.Component { } } + componentDidUpdate(prevProps) { + if (!this.autosaveInterval && this.props.project.id && !prevProps.project.id) { + this.autosaveInterval = setInterval(this.props.saveProject, 30000); + } + } + componentWillUnmount() { clearInterval(this.autosaveInterval); this.autosaveInterval = null; @@ -138,6 +144,7 @@ IDEView.propTypes = { startSketch: PropTypes.func.isRequired, stopSketch: PropTypes.func.isRequired, project: PropTypes.shape({ + id: PropTypes.string, name: PropTypes.string.isRequired, owner: PropTypes.shape({ username: PropTypes.string