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

refactor(upgrade): rename module constant to avoid webpack bug #30107

Closed

Conversation

gkalpak
Copy link
Member

@gkalpak gkalpak commented Apr 25, 2019

Backport of #30058 to 7.2.x.

UPDATE: This now, also, includes the changes from #29794 and #30126.

@gkalpak gkalpak requested a review from a team as a code owner April 25, 2019 09:01
@gkalpak gkalpak added area: upgrade Issues related to AngularJS → Angular upgrade APIs effort1: hours action: merge The PR is ready for merge by the caretaker merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note PR target: patch-only risk: low refactoring Issue that involves refactoring or code-cleanup labels Apr 25, 2019
@ngbot ngbot bot added this to the Backlog milestone Apr 25, 2019
@gkalpak
Copy link
Member Author

gkalpak commented Apr 25, 2019

merge-assistance: The changes have been reviewed/approved as part of the original PR (#30058).

@gkalpak gkalpak force-pushed the 7.2.x-refactor-upgrade-rename-module branch from f39066d to b915212 Compare April 25, 2019 09:05
@gkalpak gkalpak added state: WIP and removed action: merge The PR is ready for merge by the caretaker labels Apr 25, 2019
@mary-poppins
Copy link

You can preview f39066d at https://pr30107-f39066d.ngbuilds.io/.

@mary-poppins
Copy link

You can preview b915212 at https://pr30107-b915212.ngbuilds.io/.

…ular#30058)

When targeting ES2015 (as is the default in cli@8), `const` is not
downleveled to `var` and thus declaring `const module` throws an error
due to webpack wrapping the code in a function call with a `module`
argument (even when compiling for the `web` environment).

Related: webpack/webpack#7369

Fixes angular#30050

PR Close angular#30058
@gkalpak gkalpak force-pushed the 7.2.x-refactor-upgrade-rename-module branch from b915212 to 6bab93e Compare April 25, 2019 09:18
@gkalpak gkalpak added action: merge The PR is ready for merge by the caretaker and removed state: WIP labels Apr 25, 2019
@mary-poppins
Copy link

You can preview 6bab93e at https://pr30107-6bab93e.ngbuilds.io/.

samjulien and others added 2 commits April 25, 2019 21:48
…st` is in progress (angular#29794)

Previously, under certain circumstances, `NgZone#onMicrotaskEmpty` could
emit while a `$digest` was in progress, thus triggering another
`$digest`, which in turn would throw a `$digest already in progress`
error. Furthermore, throwing an error from inside the `onMicrotaskEmpty`
subscription would result in unsubscribing and stop triggering further
`$digest`s, when `onMicrotaskEmpty` emitted.

Usually, emitting while a `$digest` was already in progress was a result
of unintentionally running some part of AngularJS outside the Angular
zone, but there are valid (if rare) usecases where this can happen
(see angular#24680 for details).

This commit addresses the issue as follows:
- If a `$digest` is in progress when `onMicrotaskEmpty` emits, do not
  trigger another `$digest` (to avoid the error). `$evalAsync()` is used
  instead, to ensure that the bindings are evaluated at least once more.
- Since there is still a high probability that the situation is a result
  of programming error (i.e. some AngularJS part running outside the
  Angular Zone), a warning will be logged, but only if the app is in
  [dev mode][1].

[1]: https://github.com/angular/angular/blob/78146c189/packages/core/src/util/ng_dev_mode.ts#L12

Fixes angular#24680

PR Close angular#29794
With angular#30058, the ngUpgrade internal `angular.module()` method wa
renamed to `angular.module_()` (to avoid a webpack bug).

Merging angular#29794 afterwards resulted in some broken tests, because it
still used the old `angular.module()` method name. (The PR had been
tested on CI against a revision that did not contain the rename.)

This commit fixes the broken tests by renaming the remaining occurrences
of `angular.module()`.
@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

ℹ️ Googlers: Go here for more info.

@mary-poppins
Copy link

You can preview f7b9406 at https://pr30107-f7b9406.ngbuilds.io/.

@googlebot
Copy link

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

ℹ️ Googlers: Go here for more info.

AndrewKushnir pushed a commit that referenced this pull request Apr 25, 2019
) (#30107)

When targeting ES2015 (as is the default in cli@8), `const` is not
downleveled to `var` and thus declaring `const module` throws an error
due to webpack wrapping the code in a function call with a `module`
argument (even when compiling for the `web` environment).

Related: webpack/webpack#7369

Fixes #30050

PR Close #30058

PR Close #30107
AndrewKushnir pushed a commit that referenced this pull request Apr 25, 2019
…st` is in progress (#29794) (#30107)

Previously, under certain circumstances, `NgZone#onMicrotaskEmpty` could
emit while a `$digest` was in progress, thus triggering another
`$digest`, which in turn would throw a `$digest already in progress`
error. Furthermore, throwing an error from inside the `onMicrotaskEmpty`
subscription would result in unsubscribing and stop triggering further
`$digest`s, when `onMicrotaskEmpty` emitted.

Usually, emitting while a `$digest` was already in progress was a result
of unintentionally running some part of AngularJS outside the Angular
zone, but there are valid (if rare) usecases where this can happen
(see #24680 for details).

This commit addresses the issue as follows:
- If a `$digest` is in progress when `onMicrotaskEmpty` emits, do not
  trigger another `$digest` (to avoid the error). `$evalAsync()` is used
  instead, to ensure that the bindings are evaluated at least once more.
- Since there is still a high probability that the situation is a result
  of programming error (i.e. some AngularJS part running outside the
  Angular Zone), a warning will be logged, but only if the app is in
  [dev mode][1].

[1]: https://github.com/angular/angular/blob/78146c189/packages/core/src/util/ng_dev_mode.ts#L12

Fixes #24680

PR Close #29794

PR Close #30107
AndrewKushnir pushed a commit that referenced this pull request Apr 25, 2019
With #30058, the ngUpgrade internal `angular.module()` method wa
renamed to `angular.module_()` (to avoid a webpack bug).

Merging #29794 afterwards resulted in some broken tests, because it
still used the old `angular.module()` method name. (The PR had been
tested on CI against a revision that did not contain the rename.)

This commit fixes the broken tests by renaming the remaining occurrences
of `angular.module()`.

PR Close #30107
@AndrewKushnir
Copy link
Contributor

This PR is merged to patch branch.

@gkalpak gkalpak deleted the 7.2.x-refactor-upgrade-rename-module branch April 25, 2019 19:09
@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 Sep 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: upgrade Issues related to AngularJS → Angular upgrade APIs cla: yes effort1: hours merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note refactoring Issue that involves refactoring or code-cleanup risk: low
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants