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

Add support for StoryShots #479

Merged
merged 1 commit into from
Sep 22, 2016
Merged

Add support for StoryShots #479

merged 1 commit into from
Sep 22, 2016

Conversation

roonyh
Copy link
Contributor

@roonyh roonyh commented Sep 22, 2016

storyshots adds polyfills for window. So preview will incorrectly assume we’re on a browser. This will avoid that.

// check whether we're running on node/browser
const isBrowser = typeof window !== 'undefined';
// storyshots got polyfills for window so need to make sure its not storyshots
const isBrowser = typeof window !== 'undefined' && !isStoryShots;
Copy link
Member

Choose a reason for hiding this comment

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

How about this:

const { navigator } = global;
const isBrowser = navigator && navigator. userAgent !== 'storyshots';

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@arunoda yeah. updated.

@roonyh roonyh force-pushed the check-if-storyshots branch from fba3a84 to bb7cb66 Compare September 22, 2016 10:01
storyshots adds polyfills for window. So preview will incorrectly assume we’re on a browser. This will avoid that.
@roonyh roonyh force-pushed the check-if-storyshots branch from bb7cb66 to 6309b54 Compare September 22, 2016 10:04
@arunoda arunoda merged commit 4c7ada5 into master Sep 22, 2016
@arunoda arunoda deleted the check-if-storyshots branch September 22, 2016 10:06
@arunoda arunoda changed the title Check if we are on storyshots in preview Add support for StoryShots Sep 22, 2016
@shilman shilman added the misc label May 27, 2017
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