-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Open
Description
Most appropriate sub-area of p5.js?
- Accessibility
- Color
- Core/Environment/Rendering
- Data
- DOM
- Events
- Image
- IO
- Math
- Typography
- Utilities
- p5.strands
- WebGL
- DevOps, Build process, Unit testing
- Internationalization (i18n)
- Friendly Errors
- Other (specify if possible)
p5.js version
v1.11.12-rc.0
Web browser and version
Google Chrome 120.0.6099.216 (64-bit)
Operating system
Windows 11 (with WSL2, Ubuntu 22.04)
Steps to reproduce this
Steps:
- Create a new p5.js sketch using the default global mode.
- Add a preload() function that attempts to load a non-existent asset using a preload helper (e.g. loadImage) without providing an error callback.
- Open the sketch in a browser and observe that it remains stuck on “Loading…” indefinitely and setup() / draw() never execute.
Snippet:
let img;
function preload() {
// Intentionally invalid path to trigger a load failure
img = loadImage('nonexistent-image.jpg');
}
function setup() {
// This never runs
createCanvas(400, 400);
console.log('setup ran');
}
function draw() {
// This never runs
background(220);
image(img, 0, 0);
}Observed Behavior:
-
Sketch displays “Loading…” forever
-
No visible error in the sketch output
-
setup() and draw() are never called
-
Error is only visible in the browser console
Expected Behavior:
-
Preload failures should not permanently block sketch execution
-
setup() should run once all preload attempts (success or failure) complete