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

zone.js breaks GWT code #314

Closed
zhy2002 opened this issue Apr 11, 2016 · 7 comments · Fixed by #894
Closed

zone.js breaks GWT code #314

zhy2002 opened this issue Apr 11, 2016 · 7 comments · Fixed by #894

Comments

@zhy2002
Copy link

zhy2002 commented Apr 11, 2016

From 0.6 zone.js' wrapper for setTimeout and setInterval returns a task object rather than the integer value. This breaks GWT timer related classes because GWT tries to convert the object to integer to match the java function signature.
Tested in GWT 2.7.

@pkozlowski-opensource
Copy link
Member

This is pretty severe since from what I can understand we are easily breaking timers cancellation functionality. Is using zone.data.handleId an acceptable work-around?

@pkozlowski-opensource
Copy link
Member

Hmm, actually, scratch my above comment - it looks like things are canceled properly anyhow: https://plnkr.co/edit/lvHw8NQnPW5e1Z4gar1a?p=preview

@pkozlowski-opensource
Copy link
Member

setTimout also behaves properly: https://plnkr.co/edit/k6u7EbIMtBgCmoHyCxrQ?p=preview

Maybe clearTimout / clearInterval are patched to properly clear timers?

In any case it is not an issue for me any more.

@vicb
Copy link
Contributor

vicb commented Jul 6, 2016

@pkozlowski-opensource I think you're not answering the question here (ie return type).

@pkozlowski-opensource
Copy link
Member

@vicb oh, I agree that the current behaviour is less than ideal. I was just commenting that the current behaviour is not an immediate problem for me.

@recunius
Copy link

recunius commented Sep 8, 2017

This is still a problem for me. Is there any plans to support ZoneJS and GWT together?

For my use case we have a legacy GWT app that we are trying to slowly transition to Angular and this issue is causing strange behavior with GWT-RPC results. It appears that Integer objects within the return results are being changed to ZoneTask objects if the number matches the handleId.

Using GWT 2.8 and zone.js 0.8.17

@JiaLiPassion
Copy link
Collaborator

@recunius , I will make a PR to let setTimeout return original id.

JiaLiPassion added a commit to JiaLiPassion/zone.js that referenced this issue Sep 9, 2017
JiaLiPassion added a commit to JiaLiPassion/zone.js that referenced this issue Sep 9, 2017
JiaLiPassion added a commit to JiaLiPassion/zone.js that referenced this issue Sep 9, 2017
JiaLiPassion added a commit to JiaLiPassion/zone.js that referenced this issue Sep 9, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants