Skip to content
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

fix(core): host directive validation not picking up duplicate directives on component node #52073

Closed

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Oct 6, 2023

Fixes that, depending on the matching and import order, in some cases we weren't throwing the error saying that a directive matched multiple times on the same element.

Fixes #52072.

@crisbeto crisbeto added action: review The PR is still awaiting reviews from at least one requested reviewer area: core Issues related to the framework runtime target: major This PR is targeted for the next major release labels Oct 6, 2023
@ngbot ngbot bot added this to the Backlog milestone Oct 6, 2023
@crisbeto crisbeto marked this pull request as ready for review October 6, 2023 11:21
Copy link
Contributor

@jessicajaniuk jessicajaniuk left a comment

Choose a reason for hiding this comment

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

One nit otherwise LGTM

if (seenDirectives.has(current)) {
throw new RuntimeError(
RuntimeErrorCode.DUPLICATE_DIRECTITVE,
`Directive ${current.type.name} matches multiple times on the same element. ` +
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this needs the ngDevMode check to make the error message tree shakable.

Copy link
Contributor

Choose a reason for hiding this comment

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

This function is prefixed with ngDevMode && at call sites, so the entire function should be tree-shaken-away in prod.

Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

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

@crisbeto LGTM 👍

(I think it'd be great to run TGP for this change)

@AndrewKushnir AndrewKushnir added action: global presubmit The PR is in need of a google3 global presubmit and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Oct 6, 2023
@crisbeto crisbeto force-pushed the 52072/host-directives-validation branch from 163e561 to bf2b102 Compare October 8, 2023 19:20
@crisbeto
Copy link
Member Author

crisbeto commented Oct 8, 2023

Passing TGP. I also pushed a minor perf improvement.

@crisbeto crisbeto added action: presubmit The PR is in need of a google3 presubmit and removed action: global presubmit The PR is in need of a google3 global presubmit labels Oct 8, 2023
…ves on component node

Fixes that, depending on the matching and import order, in some cases we weren't throwing the error saying that a directive matched multiple times on the same element.

Fixes angular#52072.
@crisbeto crisbeto force-pushed the 52072/host-directives-validation branch from bf2b102 to 5043325 Compare October 9, 2023 15:30
@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker and removed action: presubmit The PR is in need of a google3 presubmit labels Oct 9, 2023
@atscott
Copy link
Contributor

atscott commented Oct 9, 2023

This PR was merged into the repository by commit 7368b8a.

@atscott atscott closed this in 7368b8a Oct 9, 2023
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Nov 9, 2023
ChellappanRajan pushed a commit to ChellappanRajan/angular that referenced this pull request Jan 23, 2024
…ves on component node (angular#52073)

Fixes that, depending on the matching and import order, in some cases we weren't throwing the error saying that a directive matched multiple times on the same element.

Fixes angular#52072.

PR Close angular#52073
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexposed input of hostDirective hide input of directive on host element
4 participants