Such as:


These will be loop but can't go next block.
@thisandagain Seems like the Promises in execute.js keep causing some issues - I'd be happy to do a slight refactor sometime to fix issues like this and maybe improve performance, if it makes sense?
@tmickel Agreed. I think that would be great.
This is very important to any blocks with async output, especially for those interact with hardwares.
After stepping into the code, I found that the 'waitingReporter' flag of if-else block didn't clear properly and re-enter the if-else loop infinitely.
There is a quick fix by resetting the 'waitingReporter' to the outermost thread stack.
if (thread.peekStack() === currentBlockId) {
thread.goToNextBlock();
}else{
thread.peekParentStackFrame().waitingReporter = null; // reset waiting reporter
}
code locate at https://github.com/LLK/scratch-vm/blob/bf97383b423df673397992e7d01250814523377d/src/engine/sequencer.js#L134-L136
That seems like the right bug to me @xmeow!
The cleanest place to put the reset might be here:
https://github.com/LLK/scratch-vm/blob/bf97383b423df673397992e7d01250814523377d/src/engine/thread.js#L210
I.e., as soon as the value is filled in.
I try to fix by this:
https://github.com/LLK/scratch-vm/blob/cde801bc17e34bd4c1d1e22e6c40d4773909187e/src/engine/sequencer.js#L253
==>
````
} else if (stackFrame.waitingReporter &&
!stackFrame.reported.hasOwnProperty(stackFrame.waitingReporter)) {
`````
I wonder to know if this is a good way.