Fix loading screen logo persisting after preload completes#1335
Merged
Conversation
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]>
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
state.change()orgame.world.reset()LOADER_COMPLETEevent, not justonDestroyEvent()>=18.2.1Test plan
🤖 Generated with Claude Code