Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upivy - Async pipe gets wrong ChangeDetectorRef instance when using pipe inside a component input #33677
Milestone
Comments
alxhub
added a commit
to alxhub/angular
that referenced
this issue
Nov 18, 2019
The ReflectionHost supports enumeration of constructor parameters, and one piece of information it returns describes the origin of the parameter's type. Parameter types come in two flavors: local (the type is not imported from anywhere) or non-local (the type comes via an import). ngcc incorrectly classified all type parameters as 'local', because in the source files that ngcc processes the type parameter is a real ts.Identifer. However, that identifier may still have come from an import and thus might be non-local. This commit changes ngcc's ReflectionHost(s) to properly recognize and report these non-local type references. Fixes angular#33677
alxhub
added a commit
to alxhub/angular
that referenced
this issue
Nov 18, 2019
The ReflectionHost supports enumeration of constructor parameters, and one piece of information it returns describes the origin of the parameter's type. Parameter types come in two flavors: local (the type is not imported from anywhere) or non-local (the type comes via an import). ngcc incorrectly classified all type parameters as 'local', because in the source files that ngcc processes the type parameter is a real ts.Identifer. However, that identifier may still have come from an import and thus might be non-local. This commit changes ngcc's ReflectionHost(s) to properly recognize and report these non-local type references. Fixes angular#33677
alxhub
added a commit
to alxhub/angular
that referenced
this issue
Nov 18, 2019
The ReflectionHost supports enumeration of constructor parameters, and one piece of information it returns describes the origin of the parameter's type. Parameter types come in two flavors: local (the type is not imported from anywhere) or non-local (the type comes via an import). ngcc incorrectly classified all type parameters as 'local', because in the source files that ngcc processes the type parameter is a real ts.Identifer. However, that identifier may still have come from an import and thus might be non-local. This commit changes ngcc's ReflectionHost(s) to properly recognize and report these non-local type references. Fixes angular#33677
gkalpak
added a commit
to gkalpak/angular
that referenced
this issue
Nov 19, 2019
The ReflectionHost supports enumeration of constructor parameters, and one piece of information it returns describes the origin of the parameter's type. Parameter types come in two flavors: local (the type is not imported from anywhere) or non-local (the type comes via an import). ngcc incorrectly classified all type parameters as 'local', because in the source files that ngcc processes the type parameter is a real ts.Identifer. However, that identifier may still have come from an import and thus might be non-local. This commit changes ngcc's ReflectionHost(s) to properly recognize and report these non-local type references. Fixes angular#33677
alxhub
added a commit
that referenced
this issue
Nov 19, 2019
The ReflectionHost supports enumeration of constructor parameters, and one piece of information it returns describes the origin of the parameter's type. Parameter types come in two flavors: local (the type is not imported from anywhere) or non-local (the type comes via an import). ngcc incorrectly classified all type parameters as 'local', because in the source files that ngcc processes the type parameter is a real ts.Identifer. However, that identifier may still have come from an import and thus might be non-local. This commit changes ngcc's ReflectionHost(s) to properly recognize and report these non-local type references. Fixes #33677 PR Close #33901
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Affected Package
The issue is caused by package @angular/compiler-cli/ngccIs this a regression?
Yes, it works in ViewEngine and should also work with Ivy after #31438 but it doesn't work for ngcc processed pipes.Description
When using Async pipe inside a component input Angular should inject a ChangeDetectorRef of the containing view but it injects the ChangeDetectorRef that refers to component view.
Not too long time ago there was a PR #31438 that was intended to fix that problem with pipes. It introduced
ɵɵinjectPipeChangeDetectorRef
function to injectChangeDetectorRef
so that the factory for pipe that injectsChangeDetectorRef
should look like:but we get the following:
It should be noted that ngtsc generates correct factories for user-defined pipes since in this case ngtsc uses TypeScriptReflectionHost to read metadata. The TypeScriptReflectionHost treats ChangeDetectorRef reference as ExternalExpr while Esm2015ReflectionHost treats it as a local reference
angular/packages/compiler-cli/ngcc/src/host/esm2015_host.ts
Line 1318 in b381497
Angular Version:
@alxhub @petebacondarwin @JoostK @crisbeto