Skip to content
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

vendor/detectElementResize: fix window check for SSR #945

Merged
merged 1 commit into from
Jan 5, 2018

Conversation

eqyiel
Copy link
Contributor

@eqyiel eqyiel commented Jan 5, 2018

'this' is undefined at this point, so you will get errors like Cannot read property 'requestAnimationFrame' of undefined when assigning to variable raf
on the server.

global is the analogous window object on the server.

'this' is undefined at this point, so you will get errors like `Cannot read
property 'requestAnimationFrame' of undefined` when assigning to variable `raf`
on the server.
@TrySound TrySound merged commit 2a4c52d into bvaughn:master Jan 5, 2018
@TrySound
Copy link
Contributor

TrySound commented Jan 5, 2018

Thanks

@jayaram171992
Copy link

Does this only happen in the newer node versions?

@TrySound
Copy link
Contributor

TrySound commented Jan 6, 2018

@jayaram171992 This will happen with es modules support and may happen with bundled version now because this is replaced with undefined.

@jayaram171992
Copy link

I upgraded from 9.10.1 to 9.15 and saw this issue, after upgrading to 9.16 seeing this. Not sure if they are related. Still trying to figure out whats going on currently

ReferenceError: document is not defined
    at createDetectElementResize (/Users/raramesh/Projects/N/parent/n2-web/node_modules/react-virtualized/dist/commonjs/vendor/detectElementResize.js:96:17)
    at new WindowScroller (/Users/raramesh/Projects/N/parent/n2-web/node_modules/react-virtualized/dist/commonjs/WindowScroller/WindowScroller.js:80:390)
    at /Users/raramesh/Projects/N/parent/n2-web/node_modules/react-dom/lib/ReactCompositeComponent.js:292:18
    at measureLifeCyclePerf (/Users/raramesh/Projects/N/parent/n2-web/node_modules/react-dom/lib/ReactCompositeComponent.js:73:12)
    at ReactCompositeComponentWrapper._constructComponentWithoutOwner (/Users/raramesh/Projects/N/parent/n2-web/node_modules/react-dom/lib/ReactCompositeComponent.js:291:16)
    at ReactCompositeComponentWrapper._constructComponent (/Users/raramesh/Projects/N/parent/n2-web/node_modules/react-dom/lib/ReactCompositeComponent.js:282:19)
    at ReactCompositeComponentWrapper.mountComponent (/Users/raramesh/Projects/N/parent/n2-web/node_modules/react-dom/lib/ReactCompositeComponent.js:185:21)
    at Object.mountComponent (/Users/raramesh/Projects/N/parent/n2-web/node_modules/react-dom/lib/ReactReconciler.js:43:35)
    at ReactCompositeComponentWrapper.performInitialMount (/Users/raramesh/Projects/N/parent/n2-web/node_modules/react-dom/lib/ReactCompositeComponent.js:368:34)
    at ReactCompositeComponentWrapper.mountComponent (/Users/raramesh/Projects/N/parent/n2-web/node_modules/react-dom/lib/ReactCompositeComponent.js:255:21)

@jayaram171992
Copy link

If it helps, I downgraded to 9.10 and dont see this error. 9.16 has the above error for SSR

@eqyiel
Copy link
Contributor Author

eqyiel commented Jan 6, 2018

@TrySound thanks 😄

@TrySound
Copy link
Contributor

TrySound commented Jan 6, 2018

@jayaram171992 Do you get the same error with 9.11.1, 9.12.0, 9.13.0 or 9.14.1?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants