-
-
Notifications
You must be signed in to change notification settings - Fork 310
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
Support parameter passing in component constructor #2158
Support parameter passing in component constructor #2158
Conversation
WalkthroughThe recent updates enhance the flexibility of component creation within the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Entity
participant Component
User->>Entity: addComponent(ComponentType, ...args)
Entity->>Component: new ComponentType(Entity, ...args)
Component-->>Entity: Component instance
Entity-->>User: Component instance
sequenceDiagram
participant User
participant XRManagerExtended
participant XRFeature
User->>XRManagerExtended: addFeature(FeatureType)
XRManagerExtended->>XRFeature: new FeatureType()
XRFeature-->>XRManagerExtended: Feature instance
XRManagerExtended-->>User: Feature instance
Poem
Tip AI model upgrade
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- packages/core/src/Entity.ts (2 hunks)
Additional comments not posted (2)
packages/core/src/Entity.ts (2)
758-763
: LGTM!The new type alias
ComponentArguments
is correctly implemented.
208-213
: LGTM! But verify the function usage in the codebase.The code changes are approved.
However, ensure that all function calls to
addComponent
match the new signature.
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- packages/core/src/Entity.ts (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- packages/core/src/Entity.ts
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.
Actionable comments posted: 0
Outside diff range and nitpick comments (1)
packages/xr/src/XRManagerExtended.ts (1)
Line range hint
82-89
: Fix the logical error in the loop condition.The loop condition should use
i++
instead ofi--
to iterate correctly.- for (let i = 0, n = features.length; i < n; i--) { + for (let i = 0, n = features.length; i < n; i++) {
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- packages/xr/src/XRManagerExtended.ts (2 hunks)
Additional comments not posted (3)
packages/xr/src/XRManagerExtended.ts (3)
Line range hint
78-78
: LGTM!The code is consistent with the changes made in
addFeature
.
Line range hint
94-94
: LGTM!The code is consistent with the changes made in
addFeature
.
62-63
: LGTM! But verify the function usage in the codebase.The code changes are approved.
However, ensure that all function calls to
addFeature
match the new signature.Verification successful
No additional calls to
addFeature
found.The search indicates that there are no other usages of the
addFeature
function in the codebase outside of its definition and override inXRManagerExtended.ts
. Therefore, the function signature change does not impact other parts of the codebase.
packages/xr/src/XRManagerExtended.ts
: lines 62-63Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `addFeature` match the new signature. # Test: Search for the function usage. Expect: Only occurances of the new signature. rg --type typescript $'addFeature'Length of output: 68
Script:
#!/bin/bash # Description: Verify all function calls to `addFeature` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type-add 'ts:*.ts' --type-add 'tsx:*.tsx' 'addFeature'Length of output: 322
Script:
#!/bin/bash # Description: Verify all function calls to `addFeature` match the new signature. # Test: Search for the function usage in both TypeScript and JavaScript files. Expect: Only occurrences of the new signature. rg --type-add 'ts:*.ts' --type-add 'tsx:*.tsx' --type-add 'js:*.js' --type-add 'jsx:*.jsx' 'addFeature'Length of output: 366
You can:
Summary by CodeRabbit
addComponent
method in theEntity
class for improved flexibility in component creation.addFeature
method in theXRManagerExtended
class to return more specific instance types, enhancing type safety and usability.