requestAnimationFrame polyfill breaks server-side rendering
See original GitHub issueThis code causes an exception when running on server side.
if (typeof window !== "undefined") {
win = window;
} else if (typeof self !== "undefined") {
win = self;
} else {
win = undefined;
}
// requestAnimationFrame() shim by Paul Irish
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
var request = win.requestanimationframe || win.webkitrequestanimationframe || win.mozrequestanimationframe || win.orequestanimationframe || win.msrequestanimationframe || function (callback) {
return win.settimeout(callback, 1000 / 60);
};
var request = win.requestAnimationFrame || win.webkitRequestAnimationFrame || win.mozRequestAnimationFrame || win.oRequestAnimationFrame || win.msRequestAnimationFrame || function (callback) {
[1] ^
[1]
[1] TypeError: Cannot read property 'requestAnimationFrame' of undefined
[1] at Object.<anonymous> (/home/codejunkienick/upwork/imdadmin/node_modules/react-virtualized/dist/commonjs/utils/animationFrame.js:21:18)
[1] at Module._compile (module.js:573:30)
[1] at Module._extensions..js (module.js:584:10)
[1] at Object.require.extensions.(anonymous function) [as .js] (/home/codejunkienick/upwork/imdadmin/node_modules/babel-register/lib/node.js:152:7)
[1] at Module.load (module.js:507:32)
[1] at tryModuleLoad (module.js:470:12)
[1] at Function.Module._load (module.js:462:3)
[1] at Module.require (module.js:517:17)
[1] at require (internal/module.js:11:18)
[1] at Object.<anonymous> (/home/codejunkienick/upwork/imdadmin/node_modules/react-virtualized/dist/commonjs/utils/requestAnimationTimeout.js:8:23)
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
`requestAnimationFrame` polyfill error in Jest tests
Got this error after upgrading to React when I ran my Jest unit tests: React depends on requestAnimationFrame. Make sure that you load...
Read more >Error Boundaries - React
Server side rendering ; Errors thrown in the error boundary itself (rather than its children). A class component becomes an error boundary if...
Read more >Bookmarks - A Lazy Sequence
Tradeoffs in server side and client side rendering ... His blog post breaks down how he wrote it, and how he used core.async...
Read more >(Now More Than Ever) You Might Not Need jQuery - CSS-Tricks
This simple script tag can polyfill just about anything. If you haven't heard about this polyfill service from the Financial Times you can...
Read more >A Detailed Explanation of JavaScript Game Loops and Timing
We'll cover a polyfill for node.js/io.js and lesser browsers later on. ... speculate that rendering earlier in the requestAnimationFrame ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was about to open an issue for the very same thing. This seems to be introduced when Grid has started to depend on requestAnimationFrame in v9.10.0. Rolling back reac-virtualized to v9.9.0 fixed it for me.
Here is stack-trace for the error…
Glad to hear! Again, apologies for the regression.