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

Using webcomponentsjs polyfill makes RxJS callbacks run outside NgZone on Safari #15082

Closed
aabluedragon opened this issue Mar 11, 2017 · 3 comments

Comments

@aabluedragon
Copy link

aabluedragon commented Mar 11, 2017

I'm submitting a ... (check one with "x")

[X] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior
Including the webcomponentsjs polyfill versions <=0.7.24 (for usage with Polymer1 paper-elements) makes RxJS callbacks (e.g subscribe, map) execute outside NgZone.

Expected behavior
RxJS callbacks should execute inside NgZone.

Minimal reproduction of the problem with instructions

  1. Install webcomponentsjs polyfill version <=0.7.24 (issue does not reproduce on 1.0.0-rc-6, but it can't be used with Polymer1).
  2. Add script in index.html: <script src="assets/bower_components/webcomponentsjs/webcomponents.min.js"></script>
  3. Bootstrap angular2 after the WebComponentsReady event.
window.addEventListener('WebComponentsReady', () => {
  // bootstrap angular2 here
});
  1. Execute RxJS post, notice the callback is executed outside NgZone:
this.http.post('http://jsonplaceholder.typicode.com', {}).subscribe((res)=>{
      NgZone.assertInAngularZone(); // fail
    },(err)=>{
      NgZone.assertInAngularZone(); // fail
    });

I've prepared a sample project on github to demonstrate this issue: https://github.com/aabluedragon/safari-ngzone-issue

Also posted on stackoverflow: http://stackoverflow.com/q/42700937/230637

What is the motivation / use case for changing the behavior?
Usage with Polymer1 (for polymer elements, such as paper-elements).

Please tell us about your environment:
macOS Sierra 10.12.3, Webstorm, npm, Polymer1.

  • Angular version: 2.0.X
    2.4.9

  • Browser:
    Works fine on Chrome, issue happens in Safari only.

  • Language:
    Typescript

  • Node (for AoT issues): node --version = v7.7.1

@aabluedragon aabluedragon changed the title Using webcomponentsjs polyfill makes RxJS callbacks run outside NgZone Using webcomponentsjs polyfill makes RxJS callbacks run outside NgZone on Safari Mar 11, 2017
@DzmitryShylovich
Copy link
Contributor

Please re-open it on https://github.com/angular/zone.js/issues
I don't see what we can do about it inside angular

@aabluedragon
Copy link
Author

Done.
angular/zone.js#671

@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 11, 2019
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

2 participants