You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@wylieconlon so I don’t have any particular objection to this, but it doesn’t appear to solve the original issue—a loop with a lot of console.log statements still locks up the environment. Doesn’t have to be an infinite loop at all; a simple count up to 10,000 does the trick quite nicely.
I suspect this has to do with the way the JavaScript execution is scheduled between Popcode itself (window.top) and the preview frame. Each time console.log() is called, it’s sending a postMessage up to window.top which causes an excessively expensive Redux update (particularly when performed in a tight loop). Once the top-level execution frame starts chugging, that takes priority over the execution of the loop (and the loop breaker) in the iframe. A couple years ago I did some experimentation and found evidence that browsers (at least Chrome) prioritize JavaScript execution in the top-level window over execution in iframes (which also makes intuitive sense).
Anyway, I pushed this to version 0.1.1-alpha.1 on npm, so feel free to install it in your local Popcode environment and mess around with it. LMK if you think it’s still worth merging!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a fix for popcodeorg/popcode#1354, "Loop breaking doesn't work if there's a console.log() in the loop body"