-
Notifications
You must be signed in to change notification settings - Fork 346
Development
: Migrate remaining usages of decorators for content and view child
#11480
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
base: develop
Are you sure you want to change the base?
Conversation
WalkthroughRefactors Angular query APIs: replaces decorator-based ViewChild/ContentChild with function-based viewChild/contentChild. Updates imports, declarations, and call sites accordingly in two components. No behavioral logic changes beyond accessing queried instances via callable wrappers. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/main/webapp/app/atlas/manage/generate-competencies/generate-competencies.component.ts
(3 hunks)src/main/webapp/app/atlas/shared/standardized-competencies/knowledge-area-tree.component.ts
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/main/webapp/**/*.ts
⚙️ CodeRabbit configuration file
Files:
src/main/webapp/app/atlas/manage/generate-competencies/generate-competencies.component.ts
src/main/webapp/app/atlas/shared/standardized-competencies/knowledge-area-tree.component.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: Build and Push Docker Image / Build linux/arm64 Docker Image for ls1intum/artemis
- GitHub Check: Build and Push Docker Image / Build linux/amd64 Docker Image for ls1intum/artemis
- GitHub Check: Build .war artifact
- GitHub Check: client-style
- GitHub Check: client-tests
- GitHub Check: server-tests
- GitHub Check: client-tests-selected
- GitHub Check: server-style
- GitHub Check: Analyse
🔇 Additional comments (4)
src/main/webapp/app/atlas/manage/generate-competencies/generate-competencies.component.ts (3)
1-1
: LGTM!The import correctly adds
viewChild
for the new signal-based query API.
74-74
: LGTM!The migration to
viewChild.required()
correctly replaces the non-optional@ViewChild
decorator. Usingreadonly
with the signal-based API is a best practice.
94-94
: LGTM!The usage correctly invokes the signal with
()
to access the component instance before calling its method.src/main/webapp/app/atlas/shared/standardized-competencies/knowledge-area-tree.component.ts (1)
2-2
: LGTM!The import correctly adds
contentChild
and removes theContentChild
decorator for the signal-based API migration.
readonly knowledgeAreaTemplate = contentChild(TemplateRef<{ knowledgeArea: KnowledgeAreaForTree }>); | ||
readonly competencyTemplate = contentChild(TemplateRef<{ competency: StandardizedCompetencyForTree; knowledgeArea: KnowledgeAreaForTree }>); |
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.
Incorrect selector migration breaks template matching.
The original decorators used string selectors ('knowledgeAreaTemplate'
, 'competencyTemplate'
) to match specific template reference variables. The new code uses type-based selectors (TemplateRef<...>
), which matches any projected TemplateRef
of that type, not the specifically named template. This changes the matching behavior and could break the component if multiple templates are projected.
Apply this diff to preserve the original selector behavior:
- readonly knowledgeAreaTemplate = contentChild(TemplateRef<{ knowledgeArea: KnowledgeAreaForTree }>);
- readonly competencyTemplate = contentChild(TemplateRef<{ competency: StandardizedCompetencyForTree; knowledgeArea: KnowledgeAreaForTree }>);
+ readonly knowledgeAreaTemplate = contentChild<TemplateRef<{ knowledgeArea: KnowledgeAreaForTree }>>('knowledgeAreaTemplate');
+ readonly competencyTemplate = contentChild<TemplateRef<{ competency: StandardizedCompetencyForTree; knowledgeArea: KnowledgeAreaForTree }>>('competencyTemplate');
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
readonly knowledgeAreaTemplate = contentChild(TemplateRef<{ knowledgeArea: KnowledgeAreaForTree }>); | |
readonly competencyTemplate = contentChild(TemplateRef<{ competency: StandardizedCompetencyForTree; knowledgeArea: KnowledgeAreaForTree }>); | |
readonly knowledgeAreaTemplate = contentChild<TemplateRef<{ knowledgeArea: KnowledgeAreaForTree }>>('knowledgeAreaTemplate'); | |
readonly competencyTemplate = contentChild<TemplateRef<{ competency: StandardizedCompetencyForTree; knowledgeArea: KnowledgeAreaForTree }>>('competencyTemplate'); |
🤖 Prompt for AI Agents
In
src/main/webapp/app/atlas/shared/standardized-competencies/knowledge-area-tree.component.ts
around lines 21-22, the ContentChild selectors were changed from string names to
type-based TemplateRef selectors which matches any TemplateRef and breaks
matching when multiple templates are projected; revert to using the original
string selectors (e.g. 'knowledgeAreaTemplate' and 'competencyTemplate') and use
the read option to obtain a TemplateRef with the appropriate generic types so
the decorator targets the specific template reference variable rather than any
TemplateRef.
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 wouldn't have caught it on my own, but I think we should make this change. Currently the build is failing because of this.
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.
@MarcosOlivaKaczmarek, thank you for confirming! I'm glad this caught the issue before it could cause problems with template matching. The string selector approach will ensure the component continues to work correctly when templates are projected. 🐰
__ __
/ \ /
( •.• )
^ <
/| |
(| |)
Happy to help catch this one! 🥕
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.
Just that one small thing, apart from that, it looks great to me.
readonly knowledgeAreaTemplate = contentChild(TemplateRef<{ knowledgeArea: KnowledgeAreaForTree }>); | ||
readonly competencyTemplate = contentChild(TemplateRef<{ competency: StandardizedCompetencyForTree; knowledgeArea: KnowledgeAreaForTree }>); |
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 wouldn't have caught it on my own, but I think we should make this change. Currently the build is failing because of this.
Checklist
General
Server
Client
authorities
to all new routes and checked the course groups for displaying navigation elements (links, buttons).Changes affecting Programming Exercises
Motivation and Context
Description
Steps for Testing
Prerequisites:
Exam Mode Testing
Prerequisites:
Testserver States
You can manage test servers using Helios. Check environment statuses in the environment list. To deploy to a test server, go to the CI/CD page, find your PR or branch, and trigger the deployment.
Review Progress
Performance Review
Code Review
Manual Tests
Exam Mode Test
Performance Tests
Test Coverage
Screenshots
Summary by CodeRabbit