fix(hooks): use the engine-registered script name on useScript cleanup - #345
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 82657da The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
ice1080
force-pushed
the
fix/script-name-cleanup
branch
from
September 11, 2026 00:09
2d81ff9 to
82657da
Compare
Pass the script class to ScriptComponent#destroy so the engine resolves the same name that ScriptComponent#create registered, instead of re-deriving it in useScript. This keeps cleanup correct as the engine's naming rules change, and leaves the useScript signature unchanged. The cast goes through Parameters<ScriptComponent['destroy']>[0] because released engine typings still name the deprecated ScriptType there (fixed on engine main in playcanvas/engine#9472).
commit: |
Contributor
|
Thanks for the tests and initial PR! I made a small change to make it more stable by passing the constructor to |
abstrakt8
approved these changes
Sep 25, 2026
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.
Use the constructor’s explicit
scriptNameduring cleanup, retaining the class-name fallback.Add regression coverage for
_OrbitCamerawithscriptName = 'orbitCamera': unmount removes the script and remount succeeds without duplicate warnings. Also cover fallback cleanup and include a patch changeset.Fixes #343.