-
Notifications
You must be signed in to change notification settings - Fork 26.6k
Open
Labels
area: compilerIssues related to `ngc`, Angular's template compilerIssues related to `ngc`, Angular's template compilercompiler: extended diagnosticsfeatureIssue that requests a new featureIssue that requests a new featurefeature: under considerationFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under consideration
Milestone
Description
Which @angular/* package(s) are relevant/releated to the feature request?
@angular/compiler-cli
Description
Negating an async pipe in an *ngIf
thrashes the layout because the pipe emits null
immediately before checking the condition. This can lead cause unnecessary rendering work and trigger component events which cause XHR's or other work to be done that shouldn't be needed.
<div *ngIf="!(myConditional | async)">
<!-- ... -->
</div>
http://codelyzer.com/rules/template-no-negated-async/
Proposed solution
We should consider an extended diagnostic to detect and warn the user of this anti-pattern to head-off their confusing and suggest a better alternative.
I'm not entirely sure what that alternative should be, but I imagine there's an easily transformable way of doing this?
Alternatives considered
N/A
eneajaho, itea-dev, alan-agius4, samuelfernandez, peter2796b and 21 more
Metadata
Metadata
Assignees
Labels
area: compilerIssues related to `ngc`, Angular's template compilerIssues related to `ngc`, Angular's template compilercompiler: extended diagnosticsfeatureIssue that requests a new featureIssue that requests a new featurefeature: under considerationFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under consideration