did stuff

This commit is contained in:
Cassie Tarakajian 2016-09-28 15:20:54 -04:00
parent 7fb85c251b
commit 5f23ea8132
2 changed files with 24 additions and 7 deletions

View file

@ -117,18 +117,30 @@ class PreviewFrame extends React.Component {
} }
componentDidUpdate(prevProps) { 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) { if (this.props.isPlaying !== prevProps.isPlaying) {
this.renderSketch(); this.renderSketch();
return;
} }
if (this.props.isPlaying && this.props.content !== prevProps.content) { console.log(this.props, prevProps);
this.renderSketch(); 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.content !== prevProps.content) {
if (this.props.isPlaying && this.props.files[0].id !== prevProps.files[0].id) { // this.renderSketch();
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() { componentWillUnmount() {
@ -257,7 +269,8 @@ PreviewFrame.propTypes = {
dispatchConsoleEvent: PropTypes.func, dispatchConsoleEvent: PropTypes.func,
children: PropTypes.element, children: PropTypes.element,
infiniteLoop: PropTypes.bool.isRequired, infiniteLoop: PropTypes.bool.isRequired,
resetInfiniteLoops: PropTypes.func.isRequired resetInfiniteLoops: PropTypes.func.isRequired,
autorefresh: PropTypes.bool.isRequired
}; };
export default PreviewFrame; export default PreviewFrame;

View file

@ -318,8 +318,12 @@ class IDEView extends React.Component {
isTextOutputPlaying={this.props.ide.isTextOutputPlaying} isTextOutputPlaying={this.props.ide.isTextOutputPlaying}
textOutput={this.props.preferences.textOutput} textOutput={this.props.preferences.textOutput}
dispatchConsoleEvent={this.props.dispatchConsoleEvent} dispatchConsoleEvent={this.props.dispatchConsoleEvent}
<<<<<<< HEAD
infiniteLoop={this.props.ide.infiniteLoop} infiniteLoop={this.props.ide.infiniteLoop}
resetInfiniteLoops={this.props.resetInfiniteLoops} resetInfiniteLoops={this.props.resetInfiniteLoops}
=======
autorefresh={this.props.preferences.autorefresh}
>>>>>>> did stuff
/> />
</div> </div>
</SplitPane> </SplitPane>