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

Server crashes from evaluating functions executed after setTimeout #267

Closed
qdouble opened this Issue Feb 11, 2016 · 4 comments

Comments

Projects
None yet
3 participants
@qdouble

qdouble commented Feb 11, 2016

Currently Universal will crash when parsing an unsupported function executed after setTimeOut, even though the function is not executed until after the page is fully loaded...for example...

setTimeout(() => {
            this.renderer.invokeElementMethod(this.myTag.nativeElement, 'focus', []);
 }, 100);

The above will cause "EXCEPTION: Error: not implemented". Methods called in setTimeout should either be ignored or better handled.

@gdi2290

This comment has been minimized.

Member

gdi2290 commented Feb 11, 2016

'focus' was not implemented for the server version of the DOM adaptor

@qdouble

This comment has been minimized.

qdouble commented Feb 11, 2016

@gdi2290 yes, I understand that... the issue that was brought up in slack chat is more so that the server would not be executing that function anyway since it won't execute the setTimeout block until after the page has fully downloaded, therefore the setTimeout block should be ignored or better handled.

@jeffwhelpley

This comment has been minimized.

Contributor

jeffwhelpley commented Feb 23, 2016

@gdi2290 this is interesting because some people want the body of setTimeout to be executed on the server. I think that we should likely make a hard, clear stance on async on the server. What do you think about making sure we wait on the server for both http and some new modules we create to wrap setTimeout (i.e. universalTimeout or whatever), but then all other setTimeouts are monkey patched on the server to do nothing.

Alternatively we can just tell people not to use setTimeout, but that may just lead to inevitable issues.

@gdi2290

This comment has been minimized.

Member

gdi2290 commented Apr 3, 2016

@qdouble we’re tracking setTimeout, setInterval (although no one should use this for SSR), and setImmediate now in zone.js with angular2-universal-polyfills 0.3.1 and our new way of checking when the app is stable via checkStable

@gdi2290 gdi2290 closed this Apr 3, 2016

@gdi2290 gdi2290 referenced this issue Apr 3, 2016

Closed

Angular 2 Universal production ready #247

25 of 35 tasks complete

@tinchou tinchou referenced this issue Oct 11, 2016

Closed

Server side rendering with universal #858

16 of 16 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment