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

Ivy + @Component.host + async pipe binding - Unexpected Node Error (Ivy Only) #37610

Closed
richieforeman opened this issue Jun 16, 2020 · 3 comments
Assignees
Labels
Milestone

Comments

@richieforeman
Copy link

richieforeman commented Jun 16, 2020

🐞 bug report

Affected Package

@angular/compiler

Is this a regression?

Yes, AFAIK -- This works just fine in VE

Description

If I use a @Component.host style binding with an Async pipe, the Ivy compiler gets very very angry with me. This works just fine in VE mode.

import { Component, Input } from '@angular/core';
import { of } from 'rxjs';

@Component({
  selector: 'hello',
  template: `<h1>Hello {{name}}!</h1>`,
  styles: [`h1 { font-family: Lato; }`],
  host: {'[style.display]': '(showme$|async) ? "block" : "none"'}, 
})
export class HelloComponent  {
  readonly showme$ = of(false);
  @Input() name: string;
}

🔬 Minimal Reproduction

https://stackblitz.com/edit/angular-ivy-n6mcgg?file=src%2Fapp%2Fhello.component.ts

🔥 Exception or Error

Uncaught (in promise) Error: Internal Error: Unexpected node
    at error (/turbo_modules/@angular/compiler@9.1.9/bundles/compiler.umd.js:2842)
    at ValueConverter.eval [as allocateSlot] (/turbo_modules/@angular/compiler@9.1.9/bundles/compiler.umd.js:19845)
    at ValueConverter.visitPipe (/turbo_modules/@angular/compiler@9.1.9/bundles/compiler.umd.js:18847)
    at BindingPipe.visit (/turbo_modules/@angular/compiler@9.1.9/bundles/compiler.umd.js:7853)
    at ValueConverter.AstMemoryEfficientTransformer.visitConditional (/turbo_modules/@angular/compiler@9.1.9/bundles/compiler.umd.js:8327)
    at Conditional.visit (/turbo_modules/@angular/compiler@9.1.9/bundles/compiler.umd.js:7766)
    at ASTWithSource.visit (/turbo_modules/@angular/compiler@9.1.9/bundles/compiler.umd.js:8022)
    at eval (/turbo_modules/@angular/compiler@9.1.9/bundles/compiler.umd.js:14229)
    at Array.forEach (<anonymous>)
    at StylingBuilder._buildSingleInputs (/turbo_modules/@angular/compiler@9.1.9/bundles/compiler.umd.js:14227)

🌍 Your Environment

Angular Version:


9.1.9 (From Stackblitz)

I can also dupe this internally at Google.

Anything else relevant?

@petebacondarwin petebacondarwin added area: compiler Issues related to `ngc`, Angular's template compiler engine: ivy type: bug/fix labels Jun 16, 2020
@ngbot ngbot bot modified the milestone: needsTriage Jun 16, 2020
@JoostK
Copy link
Member

JoostK commented Jun 16, 2020

Related: #34378 and #34655, but the change in #34655 is incomplete wrt Conditional nodes (and maybe more).

@richieforeman
Copy link
Author

Yup, Moving from an async pipe to a static value (e.g. a simple boolean) works just fine. It'd be nice if this worked, as our specific team are heavy heavy users of RXJS, and tend to prefer that for internal behaviors and things within a component.

@richieforeman richieforeman changed the title Ivy + @Component.host binding - Unexpected Node Error (Happens in Ivy Only) Ivy + @Component.host + async pipe binding - Unexpected Node Error (Ivy Only) Jun 16, 2020
crisbeto added a commit to crisbeto/angular that referenced this issue Jul 2, 2020
Builds on top of angular#34655 to support more cases that could be using a pipe inside host bindings (e.g. ternary expressions or function calls).

Fixes angular#37610.
@crisbeto crisbeto self-assigned this Jul 2, 2020
@crisbeto crisbeto removed this from the needsTriage milestone Jul 2, 2020
@ngbot ngbot bot added this to the needsTriage milestone Jul 2, 2020
crisbeto added a commit to crisbeto/angular that referenced this issue Jul 4, 2020
Builds on top of angular#34655 to support more cases that could be using a pipe inside host bindings (e.g. ternary expressions or function calls).

Fixes angular#37610.
atscott pushed a commit that referenced this issue Jul 10, 2020
…37883)

Builds on top of #34655 to support more cases that could be using a pipe inside host bindings (e.g. ternary expressions or function calls).

Fixes #37610.

PR Close #37883
@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 Aug 10, 2020
profanis pushed a commit to profanis/angular that referenced this issue Sep 5, 2020
…ngular#37883)

Builds on top of angular#34655 to support more cases that could be using a pipe inside host bindings (e.g. ternary expressions or function calls).

Fixes angular#37610.

PR Close angular#37883
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants