From 3d18960575fdf32773ff86c2dd30ec4ac52ad10c Mon Sep 17 00:00:00 2001 From: catarak Date: Wed, 3 Aug 2016 21:47:24 -0400 Subject: [PATCH] add autosave after new project is saved for the first time --- client/modules/IDE/pages/IDEView.js | 7 +++++++ 1 file changed, 7 insertions(+) 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