processing / processing/p5.js-web-editor

Infinite loop detection triggers on await loadImage etc in setup

Open
#4,295 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting Maintainer Approval Bug
Dominant language
JavaScript
Stars
1.7k
Forks
1.7k
Avg merge
3d 4h
Merged PRs (30d)
8

Description

p5.js version

2.3.2

What is your operating system?

Mac OS

Web browser and version

152.0.7977.82

Actual Behavior

Using a for-loop inside setup that loads resources (e.g. loadImage):

let fns = ["a.jpg", "b.jpg", "c.jpg"];
let imgs = [];

async function setup() {
  for (let i=0; i < fns.length; i++) {
    imgs.push(await loadImage(fns[i]));
  }
}
Expected Behavior

The could should run, as it isn't an infinite loop, and await loadImage() the expected pattern to use with p5.js 2.0.

Steps to reproduce

See above.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied async setup example, especially the for-loop containing await loadImage(). Trace where the editor's infinite-loop detection handles setup and awaited resource loading. Done means the example runs without a false infinite-loop warning while genuine infinite loops remain detectable.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.