Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

feat(Core): fix #910, add a flag to allow user to check duplicate Zone error. #1093

Merged
merged 1 commit into from
Jul 3, 2018

Conversation

JiaLiPassion
Copy link
Collaborator

@JiaLiPassion JiaLiPassion commented May 22, 2018

fix #910.

add a flag, __zone_symbol__forceDuplicateZoneCheck to let user choose whether to throw error when load duplicate zone.js.
By default, if the global['Zone'] is from zone.js, no error will be thrown, and if the flag is set to trure, then we will throw the error.

sometimes user may not want this Zone already loaded error.
For example,
we have two web pages, page1 includes zone.js, page2 doesn't.
and the 1st time user load page1 and page2, everything work fine,
but when user load page2 again, error occurs because global['Zone'] already exists.
so we add a flag to let user choose whether to throw this error or not.

@JiaLiPassion JiaLiPassion changed the title feat(Core): fix #910, add a flag to allow user to ignore duplicate Zone error. feat(Core): fix #910, add a flag to allow user to check duplicate Zone error. Jun 16, 2018
@JiaLiPassion JiaLiPassion force-pushed the duplicate branch 2 times, most recently from 1843c10 to 858ed49 Compare June 20, 2018 23:06
@mhevery mhevery merged commit a86c6d5 into angular:master Jul 3, 2018
@chandramuralis
Copy link

@JiaLiPassion Any idea when this fix will be released?

@RichardZandi
Copy link

@JiaLiPassion there is a similar issue, i believe, with importing native-shim in polyfills when an Angular Element tries to consume another Angular Element. It'd be great if the forthcoming zone fix would address that issue as well. Thank you.

@JiaLiPassion
Copy link
Collaborator Author

@RichardZandi, sure, thank you for the information.
@chandramuralis, I am not sure when will release, please wait for a while...

@benoitjchevalier
Copy link

benoitjchevalier commented Aug 2, 2018

Do we have any update on when this will release? This prevents using angular elements in another angular app

@JiaLiPassion
Copy link
Collaborator Author

@benoitjchevalier, I am not sure about the release date, you can use this branch for test by updating your package.json.

"zone.js": "git://github.com/JiaLiPassion/zone.js#duplicate-patch-dist"

@benoitjchevalier
Copy link

@JiaLiPassion thanks for the tips, we nicked your fix from a zip file you posted in another issue and added it to our project but pointing to the branch will be cleaner. It solves our problem 👍 .

However we're planning on distributing a packaged js file with a bunch of angular element, so we don't have control over whether consuming angular application will have this fix, hence eagerly waiting for it :)

Thank you for your work!

@aaaa0441
Copy link

aaaa0441 commented Sep 5, 2018

I need to subscribe myself to this issue, waiting for a release of the fix.

@Saphirim
Copy link

Saphirim commented Sep 6, 2018

Also waiting for an official release within Angular...

@liorwohl
Copy link

@JiaLiPassion solutions works for me. how is angular 7.0.0 released without this?

@hyahyaoui
Copy link

@JiaLiPassion thanks for the tips, we nicked your fix from a zip file you posted in another issue and added it to our project but pointing to the branch will be cleaner. It solves our problem 👍 .

However we're planning on distributing a packaged js file with a bunch of angular element, so we don't have control over whether consuming angular application will have this fix, hence eagerly waiting for it :)

Thank you for your work!

@benoitjchevalier do you have a link for the zip please ? thanks

@benoitjchevalier
Copy link

@hyahyaoui I ended up forking and manually integrating one of the PR that hasn't been merged yet and rebuilt it: "zone.js": "https://github.com/benoitjchevalier/zone.js.git#duplicate"
@JiaLiPassion also released another dist on a branch of his, probably best to use that (don't think that includes the duplicate check PR if you need it): "zone.js": "git://github.com/JiaLiPassion/zone.js#release-20181029"

@nakshay
Copy link

nakshay commented Apr 24, 2019

is this fix released, I need to fix similar issue.

@JiaLiPassion
Copy link
Collaborator Author

@nakshay, yes, this is released, you can check it with zone.js 0.9.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

zone.js loaded by twice, by two separate sources