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

Problem with the zone.js (Angular 13) #97

Closed
jakubsobel opened this issue Mar 3, 2022 · 2 comments · Fixed by DanteDeRuwe/partytown#1 or #164
Closed

Problem with the zone.js (Angular 13) #97

jakubsobel opened this issue Mar 3, 2022 · 2 comments · Fixed by DanteDeRuwe/partytown#1 or #164
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@jakubsobel
Copy link

I'm trying to use Partytown with an Angular 13 project, but it looks like the Partytown initialisation fails because of the zone.js patching of the IntersectionObserver and MutationObserver.

It looks like the Partytown's getConstructorName function is returning an empty string for the IntersectionObserver and MutationObserver when zone.js is in use, and that breaks the mainWindow[cstrName].prototype line in the partytown-sandbox-sw.js.

Minimal reproduction:
https://github.com/jakubsobel/partytown-zonejs-issue
Run using the ng serve, go to the localhost:4200, you will see the problem in the console:
Screenshot 2022-03-03 at 12 23 34

Uncomment the lines in the zone-flags.ts file. That will disable the patching of the IntersectionObserver and MutationObserver. Run the project again, Partytown will then work correctly.

@soniar4i
Copy link

Same problem here.

@adamdbradley adamdbradley added bug Something isn't working help wanted Extra attention is needed labels Mar 23, 2022
DanteDeRuwe added a commit to DanteDeRuwe/partytown that referenced this issue Apr 28, 2022
This is a solution for, and should close BuilderIO#97

Angular has zone.js and the constructor names cannot be fetched from there
@naveedahmed1
Copy link

I have verified the changes suggested by @DanteDeRuwe in pull request https://github.com/BuilderIO/partytown/pull/164/files on my local machine and it seems that this fixes this issue.

Can anyone from the team review and merge this pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
4 participants