EnsembleUI / ensemble

Build native apps 20x faster than Flutter, RN or any other tech
https://ensembleui.com/
BSD 3-Clause "New" or "Revised" License
125 stars 15 forks source link

`continue` within a `for` loop can cause browser to hang #1704

Closed amin-nas closed 3 weeks ago

amin-nas commented 3 weeks ago

Test: https://studio.ensembleui.com/app/9YfZUVl3SC82UZ5Mnf2e/screen/w6mUak1b7RCUazZYIU2f

On this screen, press the button in the footer to run the code. When the code tries to tryParseDouble this speed, it freezes the studio.

"speed": "0.0",

Note that a standalone example of doing "0.0".tryParseDouble() works fine.

kmahmood74 commented 3 weeks ago

not sure if there are multiple issues but the hanging chrome issue can be worked around by changing the for loop to a while loop

this -

      var i = pastEntries.length - 1;
      while (i >= 0) {
        //for (var i = pastEntries.length - 1; i >= 0; i--) {
      ...
      i--;
      if (pastTimestamp >= currentTimestamp) continue;
      ...

I'll debug the for loop but you should be unblocked by changing it to a while loop