diff --git a/client/modules/IDE/actions/ide.js b/client/modules/IDE/actions/ide.js index 19cb940a..7526e72c 100644 --- a/client/modules/IDE/actions/ide.js +++ b/client/modules/IDE/actions/ide.js @@ -183,9 +183,10 @@ export function setUnsavedChanges(value) { }; } -export function detectInfiniteLoops() { +export function detectInfiniteLoops(message) { return { - type: ActionTypes.DETECT_INFINITE_LOOPS + type: ActionTypes.DETECT_INFINITE_LOOPS, + message }; } diff --git a/client/modules/IDE/components/Console.js b/client/modules/IDE/components/Console.js index 07cd4633..390afd51 100644 --- a/client/modules/IDE/components/Console.js +++ b/client/modules/IDE/components/Console.js @@ -20,30 +20,23 @@ class Console extends React.Component { * @type {Array} */ this.children = []; + this.appendConsoleEvent = this.appendConsoleEvent.bind(this); } componentWillReceiveProps(nextProps) { if (nextProps.isPlaying && !this.props.isPlaying) { this.children = []; - } else if (nextProps.consoleEvent !== this.props.consoleEvent) { + } else if (nextProps.consoleEvent !== this.props.consoleEvent && this.props.isPlaying) { const args = nextProps.consoleEvent.arguments; Object.keys(args).forEach((key) => { if (args[key].includes('Exiting potential infinite loop')) { - // stop sketch - // dispatch infinite loop found this.props.stopSketch(); - this.props.detectInfiniteLoops(); + this.props.expandConsole(); + this.appendConsoleEvent(nextProps.consoleEvent); } }); if (nextProps.isExpanded) { - // const args = nextProps.consoleEvent.arguments; - const method = nextProps.consoleEvent.method; - const nextChild = ( -