Skip to content

Fix loading screen logo persisting after preload completes#1335

Merged
obiot merged 1 commit intomasterfrom
fix/loading-screen-race
Mar 29, 2026
Merged

Fix loading screen logo persisting after preload completes#1335
obiot merged 1 commit intomasterfrom
fix/loading-screen-race

Conversation

@obiot
Copy link
Copy Markdown
Member

@obiot obiot commented Mar 29, 2026

Summary

  • Fix race condition where the default loading screen's logo Sprite persists after preloading completes, caused by the async logo image load callback firing after state.change() or game.world.reset()
  • Clean up loading screen children on LOADER_COMPLETE event, not just onDestroyEvent()
  • Bump melonjs to 18.2.1
  • Update spine-plugin peerDep to >=18.2.1
  • Move spine example dropdown lower to avoid overlap with debug heap graph

Test plan

  • Spine example: no logo overlay, no texture artifacts
  • Text example: no logo overlay on fast reload
  • Sprite benchmark: no loading screen persisting
  • All examples load cleanly on both Chrome and Safari

🤖 Generated with Claude Code

The default loading screen loads its logo image asynchronously. With the
faster Promise-based loader (18.1.0+), user assets can finish loading
before the logo image, causing the logo Sprite to be added to the game
world after the state transition or game.world.reset() — with no one to
remove it.

Fix by listening for LOADER_COMPLETE to clean up loading screen children,
instead of relying solely on onDestroyEvent (which requires state.change).

Also bumps melonjs to 18.2.1 and updates spine-plugin peerDep accordingly.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings March 29, 2026 13:14
@obiot obiot merged commit b4d6a68 into master Mar 29, 2026
8 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a loader race condition in melonJS where the default loading screen’s logo sprite could be added to the world after preloading had already completed (or after a state/world reset), and updates related version constraints/documentation across packages.

Changes:

  • Add LOADER_COMPLETE-driven cleanup and a guard to prevent late async logo-load callbacks from re-adding the logo sprite after teardown.
  • Bump melonjs to 18.2.1 and update spine-plugin peer dependency/docs accordingly.
  • Adjust the Spine example UI positioning to avoid overlap with debug UI elements.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/spine-plugin/package.json Updates peer dependency constraint to require melonjs >=18.2.1.
packages/spine-plugin/README.md Updates version requirements text/table to match the new melonjs minimum.
packages/melonjs/src/loader/loadingscreen.js Introduces LOADER_COMPLETE cleanup + guards to avoid logo persistence after preload/state transitions.
packages/melonjs/package.json Bumps melonjs version to 18.2.1.
packages/melonjs/CHANGELOG.md Adds 18.2.1 changelog entry describing the loader fix.
packages/examples/src/examples/spine/ExampleSpine.tsx Moves the character dropdown lower to avoid overlap.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants