-
Notifications
You must be signed in to change notification settings - Fork 25k
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
fix(ngUpgrade): make AoT ngUpgrade work with the testability API and resumeBootstrap() #12910
Conversation
eeddddb
to
176a89f
Compare
…resumeBootstrap()
176a89f
to
07a220a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, @sjelin! Thanks for staying up late and putting this together.
@@ -59,7 +91,22 @@ export class UpgradeModule { | |||
} | |||
]); | |||
|
|||
// Make sure resumeBootstrap() only exists if the current bootstrap is deferred | |||
const windowAngular = (window as any /** TODO #???? */)['angular']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a valid use of any
so no need for the TODO
comment
I can confirm that this fixes the problem with #12717 |
…resumeBootstrap() (angular#12910)
…tstrap * With non-static ngUpgrade apps, callbacks to `whenStable` were being invoked with the wrong context * With non-static ngUpgrade apps, `resumeBootstrap` was being run outside the NgZone * Remove redundent `whenStableContext` variable Neither of the above problems with non-static apps were actually causing bugs (as far as I know), but they *might* have caused problems in the future. Inspired by angular#12910, but for non-static apps.
…tstrap * With non-static ngUpgrade apps, callbacks to `whenStable` were being invoked with the wrong context * With non-static ngUpgrade apps, `resumeBootstrap` was being run outside the NgZone * Remove redundent `whenStableContext` variable * Updated static example to get type mocks for ng1 Neither of the first twp problems were actually causing bugs (as far as I know), but they *might* have caused problems in the future. The example had to be updated to make the tests pass (no idea why this change mattered). Inspired by angular#12910, but for non-static apps.
…tstrap * With non-static ngUpgrade apps, callbacks to `whenStable` were being invoked with the wrong context * With non-static ngUpgrade apps, `resumeBootstrap` was being run outside the NgZone * Remove redundent `whenStableContext` variable * Updated static example to get type mocks for ng1 Neither of the first two problems were actually causing bugs (as far as I know), but they *might* have caused problems in the future. The example had to be updated to make the tests pass (no idea why this change mattered to that example). Inspired by angular#12910, but for non-static apps.
…tstrap * With non-static ngUpgrade apps, callbacks to `whenStable` were being invoked with the wrong context * With non-static ngUpgrade apps, `resumeBootstrap` was being run outside the NgZone * Remove redundent `whenStableContext` variable * Updated static example to get type mocks for ng1 Neither of the first two problems were actually causing bugs (as far as I know), but they *might* have caused problems in the future. The example had to be updated to make the tests pass (no idea why this change mattered to that example). Inspired by angular#12910, but for non-static apps.
…tstrap * With non-static ngUpgrade apps, callbacks to `whenStable` were being invoked with the wrong context * With non-static ngUpgrade apps, `resumeBootstrap` was being run outside the NgZone * Remove redundent `whenStableContext` variable Neither of the first two problems were actually causing bugs (as far as I know), but they *might* have caused problems in the future. Inspired by angular#12910, but for non-static apps.
…resumeBootstrap() (angular#12910)
…tstrap (#12926) * With non-static ngUpgrade apps, callbacks to `whenStable` were being invoked with the wrong context * With non-static ngUpgrade apps, `resumeBootstrap` was being run outside the NgZone * Remove redundent `whenStableContext` variable Neither of the first two problems were actually causing bugs (as far as I know), but they *might* have caused problems in the future. Inspired by #12910, but for non-static apps.
…tstrap (#12926) * With non-static ngUpgrade apps, callbacks to `whenStable` were being invoked with the wrong context * With non-static ngUpgrade apps, `resumeBootstrap` was being run outside the NgZone * Remove redundent `whenStableContext` variable Neither of the first two problems were actually causing bugs (as far as I know), but they *might* have caused problems in the future. Inspired by #12910, but for non-static apps.
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. |
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (check one with "x")
What is the current behavior? (You can also link to an open issue here)
In apps using
ngUpgrade
and AoT compilation,resumeBootstrap
causesconfig
andrun
blocks to be run outsideNgZone
, which in turn causes problems with change detection. Additionally, the testability APIs of ng1 and ng2 were not hooked together properly.What is the new behavior?
resumeBootstrap
is patched to always run inside theNgZone
, ng1 testability API is decorated to wait on the ng2 API.Does this PR introduce a breaking change? (check one with "x")
If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...
Other information:
I have no idea why the second test in
modules/@angular/upgrade/test/aot/integration/testability_spec.ts
was passing but I verified using a sample app that the decoration of the ng1 testability API was nessisary