-
-
Notifications
You must be signed in to change notification settings - Fork 36.2k
TSLCore: Update node type check to use isNode property #32540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
There was a problem hiding this 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 updates the node type checking mechanism in TSLCore from using instanceof Node to checking the .isNode property. This change aligns with the pattern used throughout the codebase where .isNode is the preferred method for identifying node objects.
Key Changes:
- Replaced
instanceof Nodecheck with.isNodeproperty check in thegetProxyParametersfunction
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/nodes/tsl/TSLCore.js
Outdated
| } | ||
|
|
||
| } else if ( params[ 0 ] instanceof Node ) { | ||
| } else if ( params[ 0 ].isNode ) { |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change from instanceof Node to .isNode could cause a runtime error if params[0] is null or undefined. While the code checks params.length > 0 on line 735, this doesn't guarantee that params[0] is not null or undefined. Consider adding a null check similar to line 685 in this file: params[ 0 ] && params[ 0 ].isNode to ensure safe property access.
| } else if ( params[ 0 ].isNode ) { | |
| } else if ( params[ 0 ] && params[ 0 ].isNode ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's safe to make this change without checking for null or undefined. Considering the additional check, it's maybe better to leave the code as it is.
Co-authored-by: Copilot <[email protected]>
|
Closing #32540 (comment) |
No description provided.