Skip to content
This repository has been archived by the owner on May 21, 2020. It is now read-only.

Fix document is not defined #23

Merged
merged 1 commit into from
Feb 27, 2017
Merged

Conversation

Redmega
Copy link
Collaborator

@Redmega Redmega commented Feb 27, 2017

Unhandled rejection ReferenceError: document is not defined
at exports.default (/path/to/node_modules/react-motion-drawer/styles.js:24:33)

Faced an issue with this in another project, realized my mistake.

This fixes the ReferenceError issue. Don't see any other issues. With this change it's working in practice now.

Unhandled rejection ReferenceError: document is not defined
    at exports.default (/path/to/node_modules/react-motion-drawer/styles.js:24:33)
@Redmega
Copy link
Collaborator Author

Redmega commented Feb 27, 2017

I made the pull request as I am not sure what the process is for updating the npm package. Was hoping you could shed some light on that. Is it just directly tied to master?

@KyleAMathews
Copy link
Collaborator

There's a npm script for making a new release.

@KyleAMathews KyleAMathews merged commit 6905aec into master Feb 27, 2017
@Redmega
Copy link
Collaborator Author

Redmega commented Feb 27, 2017

Ah, I see them. Thanks. I would prefer to let you handle the releases and such, I don't feel up to that yet.

@Redmega Redmega deleted the bugfix/document-undefined branch February 27, 2017 18:38
@KyleAMathews
Copy link
Collaborator

Cool — it's pretty easy with the script and all so whatevs :-)

@KyleAMathews
Copy link
Collaborator

And 2.1.4 is out.

@Redmega
Copy link
Collaborator Author

Redmega commented Feb 27, 2017

Sorry about that!

@KyleAMathews
Copy link
Collaborator

No worries! We're making good progress.

@Redmega
Copy link
Collaborator Author

Redmega commented Feb 27, 2017

Question is, why is the render called with an undefined document? styles() is only used in the render() function. Does this have something to do with isomorphic rendering where document is not available on the server? Maybe we can solve this another way, instead of just sticking it in an if(document)...

@KyleAMathews
Copy link
Collaborator

Yes, it's for isomorphic rendering — there's not really an easier way afaik. It's if statements or putting any code touching document inside a function that's only called on the client e.g. componentDidMount.

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

Successfully merging this pull request may close these issues.

2 participants