From 5f23ea81323a9bff99bcc3eaaeacaad9a0c2bc4e Mon Sep 17 00:00:00 2001 From: Cassie Tarakajian Date: Wed, 28 Sep 2016 15:20:54 -0400 Subject: [PATCH] did stuff --- client/modules/IDE/components/PreviewFrame.js | 27 ++++++++++++++----- client/modules/IDE/pages/IDEView.js | 4 +++ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/client/modules/IDE/components/PreviewFrame.js b/client/modules/IDE/components/PreviewFrame.js index 6f858bab..a11eb41b 100644 --- a/client/modules/IDE/components/PreviewFrame.js +++ b/client/modules/IDE/components/PreviewFrame.js @@ -117,18 +117,30 @@ class PreviewFrame extends React.Component { } componentDidUpdate(prevProps) { + // if previously the sketch was not playing, render sketch + // if playing, and autorun is on + // if content has changed or files have changed if (this.props.isPlaying !== prevProps.isPlaying) { this.renderSketch(); + return; } - if (this.props.isPlaying && this.props.content !== prevProps.content) { - this.renderSketch(); + console.log(this.props, prevProps); + if (this.props.isPlaying && this.props.autorefresh) { + if (this.props.content !== prevProps.content + || this.props.files[0].id !== prevProps.files[0].id) { + this.renderSketch(); + } } - // I apologize for this, it is a hack. A simple way to check if the files have changed. - if (this.props.isPlaying && this.props.files[0].id !== prevProps.files[0].id) { - this.renderSketch(); - } + // if (this.props.isPlaying && this.props.content !== prevProps.content) { + // this.renderSketch(); + // } + + // // I apologize for this, it is a hack. A simple way to check if the files have changed. + // if (this.props.isPlaying && this.props.files[0].id !== prevProps.files[0].id) { + // this.renderSketch(); + // } } componentWillUnmount() { @@ -257,7 +269,8 @@ PreviewFrame.propTypes = { dispatchConsoleEvent: PropTypes.func, children: PropTypes.element, infiniteLoop: PropTypes.bool.isRequired, - resetInfiniteLoops: PropTypes.func.isRequired + resetInfiniteLoops: PropTypes.func.isRequired, + autorefresh: PropTypes.bool.isRequired }; export default PreviewFrame; diff --git a/client/modules/IDE/pages/IDEView.js b/client/modules/IDE/pages/IDEView.js index 9bb42aa8..89abed05 100644 --- a/client/modules/IDE/pages/IDEView.js +++ b/client/modules/IDE/pages/IDEView.js @@ -318,8 +318,12 @@ class IDEView extends React.Component { isTextOutputPlaying={this.props.ide.isTextOutputPlaying} textOutput={this.props.preferences.textOutput} dispatchConsoleEvent={this.props.dispatchConsoleEvent} +<<<<<<< HEAD infiniteLoop={this.props.ide.infiniteLoop} resetInfiniteLoops={this.props.resetInfiniteLoops} +======= + autorefresh={this.props.preferences.autorefresh} +>>>>>>> did stuff />