Skip to content

Conversation

@Ady0333
Copy link

@Ady0333 Ady0333 commented Jan 17, 2026

Resolves #8420

Changes:

  • Ensured _decrementPreload() is always called in preload error paths, regardless of whether a user-provided error callback exists.
  • Applied this fix consistently across all preload utilities so failed assets no longer block sketch execution.

Files updated:

  1. src/image/loading_displaying.js
  2. Fixed preload counter decrement in:
  3. GIF arrayBuffer error handler
  4. Non-GIF img.onerror handler
  5. fetch().catch() handler
  6. src/typography/loading_displaying.js
  7. Fixed opentype.load error handler in loadFont
  8. src/io/files.js
  9. Fixed error handlers for:
  10. loadJSON
  11. loadStrings
  12. loadTable
  13. loadXML
  14. loadBytes
  15. src/webgl/loading.js
  16. Fixed unsupported file type error path in loadModel
  17. Behavior before:
  18. Asset fails + no error callback → preload never completes
  19. Sketch stuck indefinitely on “Loading…”
  20. setup() / draw() never execute
  21. Behavior after:
  22. Asset fails → error is logged (or callback called)
  23. Preload counter decrements correctly
  24. setup() executes, allowing sketches to continue gracefully

PR Checklist

  • [✔️] npm run lint passes
  • [Inline reference] is included / updated
  • [Unit tests] are included / updated

Always call _decrementPreload() in error handlers regardless of whether
a failureCallback was provided. Previously, failed preloads without
callbacks would leave _preloadCount > 0 forever, preventing setup()
from running.

Signed-off-by: Ady0333 <[email protected]>
@Ady0333
Copy link
Author

Ady0333 commented Jan 17, 2026

Hi @davepagurek, Greetings !!
This PR ensures _decrementPreload() is always called on preload errors, even when no failure callback is provided, preventing sketches from hanging indefinitely on “Loading…”.

Happy make any adjustments if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed Preloads Without Error Callbacks Cause Permanent Sketch Hang

1 participant