question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ServerModule + NoopAnimationsModule - Cannot read property 'display' of undefined at cloakElement

See original GitHub issue

I’m submitting a…


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

When prerendering application with animated components this error happens despite that NoopAnimationsModule is provided on server side instead of BrowserAnimationsModule. I use @angular/material but looking at this stack trace I believe it’s hardly relevant here:

ERROR TypeError: Cannot read property 'display' of undefined
    at cloakElement (\node_modules\@angular\animations\bundles\animations-browser.umd.js:4374:50)
    at \node_modules\@angular\animations\bundles\animations-browser.umd.js:4386:79
    at Array.map (native)
    at cloakAndComputeStyles (\node_modules\@angular\animations\bundles\animations-browser.umd.js:4386:47)
    at TransitionAnimationEngine._flushAnimations (\node_modules\@angular\animations\bundles\animations-browser.umd.js:3880:46)
    at TransitionAnimationEngine.flush (\node_modules\@angular\animations\bundles\animations-browser.umd.js:3703:32)
    at InjectableAnimationEngine.AnimationEngine.flush (\node_modules\@angular\animations\bundles\animations-browser.umd.js:4642:32)
    at \node_modules\@angular\platform-browser\bundles\platform-browser-animations.umd.js:333:30
    at ZoneDelegate.invoke (\node_modules\zone.js\dist\zone-node.js:391:26)
    at Zone.run (\node_modules\zone.js\dist\zone-node.js:141:43)
    at NgZone.runOutsideAngular (\node_modules\@angular\core\bundles\core.umd.js:3876:83)
    at AnimationRendererFactory.end (\node_modules\@angular\platform-browser\bundles\platform-browser-animations.umd.js:331:24)
    at ViewRef_.detectChanges (\node_modules\@angular\core\bundles\core.umd.js:10203:16)
    at \node_modules\@angular\core\bundles\core.umd.js:4839:63
    at Array.forEach (native)
    at ApplicationRef_.tick (\node_modules\@angular\core\bundles\core.umd.js:4839:25)

Expected behavior

Those functions should not be called on server side since style is not defined on Element there.

Minimal reproduction of the problem with instructions

I believe it can be reproduced by calling platformServer.renderModuleFactory(AppModule) if AppModule contains ServerModule, NoopAnimationsModule and some component with animations

What is the motivation / use case for changing the behavior?

Would be nice to avoid polluting logs with these errors

Environment


Angular version: 4.3.3


Browser: any
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
 
For Tooling issues:
- Node version: 8.0.0  
- Platform:  Win 10 

Others:

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:20
  • Comments:17 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
vikermancommented, Sep 28, 2017

I will have time to look into this next week and get it into the next 4.x patch release

4reactions
AndriiZelenskyicommented, Sep 4, 2017

@vikerman Do you have any updates or workaround for this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot set property 'display' of undefined and loader not ...
I have come across a problem in which I get the following error: "Uncaught TypeError: Cannot set property 'display' of undefined".
Read more >
cannot read properties of undefined in angular - You.com
1 Answer. The problem is that as an Input variable, the reminders object is initially undefined until angular has finished initializing the component....
Read more >
Cannot read properties of undefined' - JavaScript Debugging
Join Discord https://selftaught-dev.com/join-discord//r/SelfTaughtDev - https://www.reddit.com/r/selftaughtdevGet My Resume Template Free ...
Read more >
ANGULAR 13 TypeError Cannot read property of undefined
In this tutorial, we will see a most common error faced by the Angular developers named as "TypeError Cannot read property of undefined...
Read more >
Cannot read property of undefined, using a service to ... - Reddit
Running into this error, core.js:6241 ERROR TypeError: Cannot read property 'length' of undefined. Want to display the following text if the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found