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

Non-imported standalone components combined with a directive are not reported during compilation #51064

Closed
PowerKiKi opened this issue Jul 17, 2023 · 6 comments
Labels
area: core Issues related to the framework runtime
Milestone

Comments

@PowerKiKi
Copy link
Contributor

Which @angular/* package(s) are the source of the bug?

compiler

Is this a regression?

No

Description

In a standalone component, if a component is used but not imported and it also have an imported directive, then the non-imported component will incorrectly:

  • not be reported as an error during compilation
  • not be reported as an error, nor rendered, during runtime

This create bugs that are hard to detect, especially if the component has a small visual impact and/or you don't visually check every single page.

I expect that a non-imported component always raise errors during compilation, even if they also use directives.

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/stackblitz-starters-nkbwdm

Please provide the exception or error you saw

N/A

Please provide the environment you discovered this bug in (run ng version)

Angular 16.1.5

Anything else?

This seems related to #46351, though I don't think that it really is the same issue.

PowerKiKi referenced this issue in unil-lettres/dilps-tiresias Jul 17, 2023
@jessicajaniuk jessicajaniuk added the area: core Issues related to the framework runtime label Jul 17, 2023
@ngbot ngbot bot added this to the needsTriage milestone Jul 17, 2023
@yogeshgadge
Copy link

I am facing the same issue since upgrading to standalone components.
Now my app just fails to behave without any errors or warnings.

@yogeshgadge
Copy link

@jessicajaniuk we are having numerous defects due to this issue. Wondering any movement on this

In our case we don;t even directives. e.g. MatButton could be imported but it is not imported and causes.

Then the FlexLayout directives are never caught e.g. fxShow wondering what is the recourse other than not use standalone components ?

@PowerKiKi
Copy link
Contributor Author

In the meantime, the workaround for us is to rely on PhpStorm to highlight the markup in the template. This is clearly suboptimal since it is very easy to miss the visual indication, and not everyone is using PhpStorm.

@PowerKiKi
Copy link
Contributor Author

@jessicajaniuk is there anything we can do on our side to hep get this issue solved ?

@pkozlowski-opensource
Copy link
Member

This is a duplicate of #46351

We don't have great resolution at the moment as Angular template syntax does not distinguish between a directive attribute and a regular attribute.

Let's centralize the discussion in #46351

@pkozlowski-opensource pkozlowski-opensource closed this as not planned Won't fix, can't repro, duplicate, stale Oct 17, 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 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: core Issues related to the framework runtime
Projects
None yet
Development

No branches or pull requests

4 participants