Skip to content

Fix Duplicate ng-template Names#8049

Merged
kubermatic-bot merged 1 commit intokubermatic:mainfrom
KhizerRehan:fix/ng-template-names
May 6, 2026
Merged

Fix Duplicate ng-template Names#8049
kubermatic-bot merged 1 commit intokubermatic:mainfrom
KhizerRehan:fix/ng-template-names

Conversation

@KhizerRehan
Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Angular enforces unique ng-template names to avoid ambiguity in schematic processing, and this issue was discovered while testing the Angular migration script, as duplicate template names could lead to corrupt or incorrect transformation output.

FYI: This restriction was introduced with Angular 17's control-flow schematic and is enforced in all
subsequent versions (Angular 18, 19, 20+).

Angular GitHub references:

  • PR #53204 — "Update CF migration to skip templates with duplicate ng-template names" (Nov 28, 2023)

Which issue(s) this PR fixes:

Ref: #7675

What type of PR is this?
/kind cleanup

Special notes for your reviewer:

FYI:
Found while running the migration script: it didn’t auto-convert some files and showed a warning, but this is a pure rename to satisfy Angular’s requirement for unique ng-template names within a component, with no behavior change.

Does this PR introduce a user-facing change? Then add your Release Note here:

NONE

Documentation:

NONE

Test issue:

NONE

@kubermatic-bot kubermatic-bot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. test-issue/none Denotes a PR that doesn't need a test issue (changes). docs/none Denotes a PR that doesn't need documentation (changes). dco-signoff: yes Denotes that all commits in the pull request have the valid DCO signoff message. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 29, 2026
@Input() label: string;
@ViewChild(TemplateRef) template: TemplateRef<any>;
@ContentChild('tabLabel') labelTemplate: TemplateRef<any>;
@ContentChild(TemplateRef) labelTemplate: TemplateRef<any>;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for Reviewer:

Why I did changed from "string" to TemplateRef

  • @ ContentChild('tabLabel') uses a fixed template name as a shared contract between parent and child, so every <km-tab> must define #tabLabel, which can lead to duplicate names in the same template when multiple siblings exist.

  • @ ContentChild(TemplateRef) has no naming contract and simply picks up the projected template per instance, so each <km-tab> resolves its own content independently with no collisions.

@KhizerRehan
Copy link
Copy Markdown
Contributor Author

/test pre-dashboard-web-integration-tests-ce

1 similar comment
@KhizerRehan
Copy link
Copy Markdown
Contributor Author

/test pre-dashboard-web-integration-tests-ce

@KhizerRehan KhizerRehan requested a review from ahmadhamzh May 4, 2026 08:07
Copy link
Copy Markdown
Contributor

@ahmadhamzh ahmadhamzh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@kubermatic-bot kubermatic-bot added the lgtm Indicates that a PR is ready to be merged. label May 6, 2026
@kubermatic-bot
Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 45c8af62a3bed11ec28b3f5d2c50c41575581a33

@kubermatic-bot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahmadhamzh

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubermatic-bot kubermatic-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 6, 2026
@KhizerRehan
Copy link
Copy Markdown
Contributor Author

/test pre-dashboard-web-integration-tests-ce

@kubermatic-bot kubermatic-bot merged commit a12f29c into kubermatic:main May 6, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Denotes that all commits in the pull request have the valid DCO signoff message. docs/none Denotes a PR that doesn't need documentation (changes). kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. test-issue/none Denotes a PR that doesn't need a test issue (changes).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants