Open
Conversation
用 boneIdx == null 代替 !boneIdx
Greptile's behavior is changing!From now on, if a review finishes with no comments, we will not post an additional "statistics" comment to confirm that our review found nothing to comment on. However, you can confirm that we reviewed your changes in the status check section. This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR". |
Code Size Check Report
Interface Check ReportThis pull request does not change any public interfaces ! |
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.
用 boneIdx == null 代替 !boneIdx
Re: #
Changelog
Continuous Integration
This pull request:
Compatibility Check
This pull request:
Greptile Summary
This PR fixes a critical bug in the Spine skeleton socket binding logic where bone index
0was incorrectly treated as missing due to JavaScript's falsy evaluation.Key Changes
!boneIdxtoboneIdx == nullin_updateSocketBindings()method_cachedSocketsMap stores bone indices (numbers starting from 0), so!boneIdxwould falsely evaluate to true whenboneIdxis0Impact
This is a correct and important fix that ensures bones at index 0 can be properly used as socket attachment points in Spine animations.
Confidence Score: 5/5
!boneIdxtoboneIdx == nullis the proper way to check for undefined/null values when 0 is a valid value. This is a single-line change with clear intent and no side effects.Important Files Changed
Sequence Diagram
sequenceDiagram participant Client participant Skeleton participant _cachedSockets as _cachedSockets Map participant _socketNodes as _socketNodes Map Client->>Skeleton: _updateSocketBindings() Skeleton->>Skeleton: Check if _skeleton exists loop For each socket Skeleton->>Skeleton: Get socket.path and socket.target Skeleton->>_cachedSockets: get(socket.path) _cachedSockets-->>Skeleton: boneIdx (could be 0, undefined, or other number) alt boneIdx == null (NEW FIX) Skeleton->>Skeleton: error("path not found") Skeleton->>Skeleton: continue to next socket else boneIdx is valid (including 0) Skeleton->>_socketNodes: set(boneIdx, socket.target) end end Note over Skeleton,_socketNodes: Before fix: boneIdx=0 incorrectly triggered error<br/>After fix: boneIdx=0 properly sets socket binding