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

vaadin 7.7 with zone js - #551

Closed
dcabrera22 opened this issue Dec 19, 2016 · 8 comments
Closed

vaadin 7.7 with zone js - #551

dcabrera22 opened this issue Dec 19, 2016 · 8 comments

Comments

@dcabrera22
Copy link

Hello. I have a problem with zone.js.
I am using Liferay portlets. In one portlet I had a vaadin portlet and in other portlet i have a portlet portlet who use zone js.

Using the vaadin portlet (for example clicking a button) in some cases i got a "Converting circular structure to JSON". Stack:

GMT-300 2016 com.vaadin.client.ApplicationConfiguration
SEVERE: (TypeError) : Converting circular structure to JSON
com.google.gwt.core.client.JavaScriptException: (TypeError) : Converting circular structure to JSON
at Unknown.yfb(test.vaadin.view.ViewDashletWidgetset-0.js)
at Unknown.Uj(test.vaadin.view.ViewDashletWidgetset-0.js)
at Unknown.Lj(test.vaadin.view.ViewDashletWidgetset-0.js)
at Unknown.tj(test.vaadin.view.ViewDashletWidgetset-0.js)
at Unknown.sj(test.vaadin.view.ViewDashletWidgetset-0.js)
at Unknown.eval(test.vaadin.view.ViewDashletWidgetset-0.js)
at Unknown.wrapFn(http://localhost:8380/o3-parts-web/angular-dashlet/js/polyfills.js?cache=false)
at Unknown.invokeTask(http://localhost:8380/o3-parts-web/angular-dashlet/js/polyfills.js?cache=false)
at Unknown.runTask(http://localhost:8380/o3-parts-web/angular-dashlet/js/polyfills.js?cache=false)
at Unknown.ZoneTask.invoke(http://localhost:8380/o3-parts-web/angular-dashlet/js/polyfills.js?cache=false)
Jgb @ test.vaadin.view.ViewDashletWidgetset-0.js:formatted:60233uhb @ test.vaadin.view.ViewDashletWidgetset-0.js:formatted:33851thb @ test.vaadin.view.ViewDashletWidgetset-0.js:formatted:16817iZd @ test.vaadin.view.ViewDashletWidgetset-0.js:formatted:5172iCb @ test.vaadin.view.ViewDashletWidgetset-0.js:formatted:62420wj @ test.vaadin.view.ViewDashletWidgetset-0.js:formatted:16980Uj @ test.vaadin.view.ViewDashletWidgetset-0.js:formatted:27567Lj @ test.vaadin.view.ViewDashletWidgetset-0.js:formatted:15246tj @ test.vaadin.view.ViewDashletWidgetset-0.js:formatted:13234sj @ test.vaadin.view.ViewDashletWidgetset-0.js:formatted:28285(anonymous function) @ test.vaadin.view.ViewDashletWidgetset-0.js:formatted:22140wrapFn @ zone.js:855ZoneDelegate.invokeTask @ zone.js:262Zone.runTask @ zone.js:151ZoneTask.invoke @ zone.js:332

Without zone.js in the same page, Vaadin portlet works well.

Any idea why zone.js could generate this error?

Thanks
Diego

@JiaLiPassion
Copy link
Collaborator

could you provide a repo or plunker to reproduce the issue?

@dcabrera22
Copy link
Author

dcabrera22 commented Dec 20, 2016

Hello.
I couldn't share on plunker (vaadin use java)
I send you a zip with the code (with maven compile) and a link to test in our test server.
http://o3case.ideasoft.biz/test/?debug=true

To compile and run with maven:
mvn clean package
mvn jetty:run

I hope you could help me.
Thank you
Diego

test.zip

@JiaLiPassion
Copy link
Collaborator

JiaLiPassion commented Dec 21, 2016

I think the reason is that the JSON.stringify will convert a object which has the eventhandler as ZoneTask, and JSON.stringify ZoneTask will cause circular structure error.
Because the test.vaadin.view.ViewDashletWidgetset-0.js is generated, so I don't know how to modify it...., if the JSON convert part in vaadin can be customized, maybe this issue can be resolved, but I don't think there is anything can be done in zone.js now.

@dcabrera22
Copy link
Author

Hello. Thanks for answer.
I could change vaadin compilation to generate better js.
You could see here: http://o3case.ideasoft.biz/test/?debug=true

Another thing I try was..... comment the patchTimer for the "timeout" in zone.js.
And it's look that vaadin work well for a while. And doesn't see any problem in angular app.

Thanks again.
Regards
Diego

@JiaLiPassion
Copy link
Collaborator

@dcabrera22, thanks for the reply, and If you can modify the generator, maybe you can do some check when stringify ZoneTask.

@dcabrera22
Copy link
Author

Hello.
Which generator? vaadin generator? I don't touch the vaadin generator. I only could change the "vaadin-maven-plugin" in the pom.xml to say vaadin that generate script with more detailed.

Or do you say touch something in the zone.js?

@JiaLiPassion
Copy link
Collaborator

@dcabrera22 , I will make a PR to add toJSON to ZoneTask, hope it can resolve your issue.

@dcabrera22
Copy link
Author

Excelent!!
Works in my little example. http://o3case.ideasoft.biz/test/?debug=true

Do you know when release this? in witch version?
Thanks a lot.
Regards
Diego

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