-
Notifications
You must be signed in to change notification settings - Fork 12k
change detection behaving differently with cli build #2752
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
Comments
Hm.... can you try something? In the CLI project, remove everything from
Tell me if change detection behaves the same way as the SystemJS version. |
Thank you for the reply. I'll give this a try first thing tomorrow morning when I get to the office and let you know if there's any difference. |
Ok tried this and it worked as expected! And without needing to resort to timeouts or any other means of explicitly trigger change detection. Below is what I commented out of polyfills. Same three scripts and installed versions matched.
So what's different here other than the "main=browser" in the querystring when pulling down zone? I really appreciate the response and I'm glad to see this working again, but if you have any ideas as to why it wasn't working the other way I'd be interested to hear them. Thanks again! |
Just as an aside, if I import the polyfill scripts in index.html using local versions I already had in node_modules rather than pulling them down from the CDN, it still works. I also noticed that in the latest version of the docs re: using webpack on angular.io, zone is pulled in with a require rather than an import like so:
I tried switching back to using the polyfills.ts with this code and change detection was still broken despite the require. Also, while the angular docs show this pattern of wrapping zone in a require, the latest angular-cli still uses import on zone.js in the polyfills.ts file created by ng new. |
Wow! I can confirm this issue too. Thanks @doubletriplezero for the investigation and @filipesilva for the solution cause I was resorting to |
Just for easy reference: If I get this correctly, the workaround can be applied to AngularCLI project by:
|
I can confirm that the modification to the scripts array in The only thing I would add is that these three scripts should be placed before any others that might also be listed in the scripts array. We already had two scripts in the script array of But it seems to me that adding these to the scripts array in Thanks again for your help in finding this workaround. |
I think this issue can be closed as the workaround does solve the problem, but I'm wondering if the default behavior of the cli and its use of |
Well... there was some talk of how having the zone polyfills being loaded through imports, and it's timing, might affect zones somewhat, but it was a theoretical discussion. We hadn't found a real work example where it happened. Apparently now we have. Let me keep this open still, we'll try to find more solutions to this problem. |
@doubletriplezero something to note is that minification and tree shaking does not currently occur for scripts |
@clydin ah ok, thanks, that's good to know. |
anyone else with this issue have the workaround not working for them? http://stackoverflow.com/questions/40188759/angular-2-change-detection-delayed-several-seconds-with-arrays-and-inputs/40190695#40190695 |
I updated the workaround instructions above #2752 (comment) to accommodate a problem you'd face when using In theory, you might still get weird issues in tests, because the |
Polyfills found in polyfills.ts would not be available for scripts due to being loaded in the main bundle only. Fix angular#2752 Fix angular#3309
Polyfills found in polyfills.ts would not be available for scripts due to being loaded in the main bundle only. Fix angular#2752 Fix angular#3309
Polyfills found in polyfills.ts would not be available for scripts due to being loaded in the main bundle only. Fix angular#2752 Fix angular#3309
Polyfills found in polyfills.ts would not be available for scripts due to being loaded in the main bundle only. Fix angular#2752 Fix angular#3309
Polyfills found in polyfills.ts would not be available for scripts due to being loaded in the main bundle only. Fix angular#2752 Fix angular#3309
Polyfills found in polyfills.ts would not be available for scripts due to being loaded in the main bundle only. Fix angular#2752 Fix angular#3309
Polyfills found in polyfills.ts would not be available for scripts due to being loaded in the main bundle only. Fix angular#2752 Fix angular#3309
Polyfills found in polyfills.ts would not be available for scripts due to being loaded in the main bundle only. Fix angular#2752 Fix angular#3309
Polyfills found in polyfills.ts would not be available for scripts due to being loaded in the main bundle only. Fix angular#2752 Fix angular#3309
Polyfills found in polyfills.ts would not be available for scripts due to being loaded in the main bundle only. Fix angular#2752 Fix angular#3309
Polyfills found in polyfills.ts would not be available for scripts due to being loaded in the main bundle only. This PR loads polyfills as a separate entry point, before everything else. Extra documentation also added to polyfills.ts. Fix angular#2752 Fix angular#3309 Fix angular#4140
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
OS?
@angular/common: 2.1.0
@angular/compiler: 2.1.0
@angular/core: 2.1.0
@angular/forms: 2.1.0
@angular/http: 2.1.0
@angular/platform-browser: 2.1.0
@angular/platform-browser-dynamic: 2.1.0
@angular/router: 3.1.0
core-js: ^2.4.1
rxjs: 5.0.0-beta.12
ts-helpers: ^1.1.1
zone.js: ^0.6.25
Repro steps.
Unfortunately, our app and the situations in which this issue occurs are prohibitively complex to provide a simple way to reproduce the problem. Essentially, the change detector is not fired in all situations where we would expect it to.
Detailed explanation of the issue can be found here http://stackoverflow.com/questions/40047415/angular-2-change-detection-behaves-differently-with-cli-webpack
The log given by the failure.
No error is thrown, change detection simply fails to run when expected.
The text was updated successfully, but these errors were encountered: