-
Notifications
You must be signed in to change notification settings - Fork 26
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
Wrap window references for SSR #531
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found some potential errors. Also, I'm not able to test on CodeSandbox for some reason. The terminal runs to here:
So I haven't been able to test how this works. I don't see any gatsby config files in the repo, just on the sandbox. I'm guessing in lieu of using sandbox I could install the gatsby-cli?
@@ -12,21 +13,21 @@ class CanvasParticles extends React.Component { | |||
componentDidMount() { | |||
window.requestAnimFrame = (function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you not need to do a check that window
has requestAnimFrame
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is setting a property on window
, which we've imported from global
, rather than getting a property, it should be fine
@Dianna ready when you have a chance to take another look |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The small issues I found have been fixed 👍
Addresses #503
Still requires the Webpack configuration tweak to work with Gatsby, as described in their documentation on this issue. I feel like there is a workaround for the two offending modules, but I'm not sure what it is.
I added the global module as a dependency for this purpose.