Skip to content
This repository has been archived by the owner on Oct 5, 2022. It is now read-only.

fix: make sure document is defined #8

Merged
merged 2 commits into from
Feb 12, 2018

Conversation

KnisterPeter
Copy link
Contributor

@KnisterPeter KnisterPeter commented Feb 9, 2018

Check if global document exists to attach styles to.

Relates to #4

Copy link
Owner

@sapegin sapegin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

src/styles.ts Outdated
const container = document.querySelector('head');
if (!container) {
throw new Error('<head> tag not found');
if (typeof document !== 'undefined') {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to use an early return here instead of wrapping the whole thing in a condition.

@KnisterPeter
Copy link
Contributor Author

@sapegin Updated as you recommended.

@sapegin sapegin merged commit 5988e85 into sapegin:master Feb 12, 2018
@sapegin
Copy link
Owner

sapegin commented Feb 12, 2018

Awesome, merged!

Does it fix #4 or something else is needed?

@KnisterPeter
Copy link
Contributor Author

I've not tested if it fully supports SSR

@KnisterPeter
Copy link
Contributor Author

Thanks for merging

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

Successfully merging this pull request may close these issues.

2 participants