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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaking change in Ivy data binding! #39044

Closed
bernatgy opened this issue Sep 29, 2020 · 4 comments
Closed

Breaking change in Ivy data binding! #39044

bernatgy opened this issue Sep 29, 2020 · 4 comments

Comments

@bernatgy
Copy link

bernatgy commented Sep 29, 2020

馃悶 bug report

Affected Package

Ivy - I'm not familiar with the exact package / packages.

Is this a regression?

Could not answer. We went from Angular 7.2.9 to 9.1.12 over a few days, and we used the default "staticness" of our @ViewChild queries before. Through the updates we had to switch some queries over to { static: true } because errors arose.

Description

As you know, there are multiple ways to bind to a string Input property. I'll mention two of them;

a.) someProperty="Some static string..."
聽聽聽聽Which will only bind once.
b.) [someProperty]="'Some string...'"
聽聽聽聽Which will participate in change detection as usual, and the string can change.

Without Ivy, these two ways pretty much perform the same. Note: We are talking about non-changing (at least through template binding) string values.

We have multiple systems in which we may override these provided strings in code, hence why we use the first type of binding (a). These systems seem to silently fail with Ivy on. After lots of debugging I figured that Ivy handles something differently. I'm pretty sure that the issue seems to arise from the combination of static resolution, binding type (a), and the override's timing, however these issues are incredibly hard to detect, and would even require complete redesigns of some of our systems.

In my attached StackBlitz, I've prepared;

  1. an example with binding type (a) which seems to have preserved it's inner workings
  2. an example with binding type (b) which completely flips on it's head when Ivy is turned on (uncheck / check Enable Ivy, under Settings)
  3. a possible workaround (???) which seems so bad... (I'd be interested in opinions on this)

馃敩 Minimal Reproduction

StackBlitz, second example, turn Ivy on / off

馃敟 Exception or Error

None

馃實 Your Environment

Angular Version:


Angular CLI: 9.1.12
Node: 12.18.3
OS: win32 x64

Angular: 9.1.12
... animations, cli, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic, router
Ivy Workspace: 

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.12
@angular-devkit/build-angular     0.901.12
@angular-devkit/build-optimizer   0.901.12
@angular-devkit/build-webpack     0.901.12
@angular-devkit/core              9.1.12
@angular-devkit/schematics        9.1.12
@ngtools/webpack                  9.1.12
@schematics/angular               9.1.12
@schematics/update                0.901.12
rxjs                              6.6.3
typescript                        3.8.3
webpack                           4.42.0

Anything else relevant?
Tested on Google Chrome 85.0.4183.121 (Official Build) (64-bit)
Production mode seems not to influence it.

I realize what we're doing is not recommended, and that the example may not make much sense to you. But I firmly think it should be supported, and that the difference of behaviour should at least be documented (if it's not a bug). Furthermore, the cases in which we do this predominantly make sense, I just can't share much more.

@JoostK
Copy link
Member

JoostK commented Sep 29, 2020

This looks to be the same as #34227.

@bernatgy
Copy link
Author

bernatgy commented Sep 29, 2020

@JoostK It is! I apologize, I tried to search for it, it's just soo confusing. That's why my title is like this. Couldn't fit it into a sentence.

Please mark as duplicate if you choose to.

PS: The issue is still very much urgent, and breaks lots of things for us as well.

@AndrewKushnir
Copy link
Contributor

Closing this ticket as a duplicate of #34227.

@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 Oct 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants