Code in draw loop doesn't run

bug

#1

Sometimes code in the draw loop is not executed. I’ve seen this on projects that are as simple as:

function draw() {
  background("red");
  rect(200, 200);
}

Whenever this happens it can be fixed by either starting over (Version History > Start Over) or by simply hitting the Remix button if you are working on a project, reloading the page also seems to work.

Wondering if anyone knows how to either reliably reproduce the problem or to avoid it.


#2

Douglas,

Is this the exact code? I only ask because the draw loop needs to be a function. The code should be function draw - and maybe resetting the level adds the function keyword in? If that isn’t the case I would submit a bug report via the “hamburger menu” in the top right corner.

Hope that helps!
Brad


#3

Oops, good catch - no, that’s not the exact code. I typed it in in a hurry and wasn’t thinking. The code is code is right and I’m pretty sure it is a bug. It seems to happen intermittently when a student makes an error and then corrects it. Reloading the page seems to always correct the problem.

I’m starting to think that this happens (on Windows 10 with Chrome) when district policy blocks student access to the JavaScript console. That’s a hunch, I have never been able to reproduce the problem on my computer, but I have access to the developer tools. Again it is intermittent. Sometimes it works exactly as you’d expect…


#4

Douglas,

Can you share the code with the “Share” button in the top left corner? Then we’d be able to get eyes on it and figure it out together!

Brad


#5

I don’t have a broken example… I’m pretty sure it is an IDE issue, not a code issue. The problem, so far, has always resolved when the page is reloaded or remixed.

I’m starting to think that it may be related to my lab configuration - we have the developer tools blocked for some reason (not the intention of our IT staff), and it seems to be tied to errors in the student code. However fixing the bug does not resolve the problem (but reloading the page does fix it).