From 6309b5437ea1f655005d25988812a270e245f914 Mon Sep 17 00:00:00 2001 From: Aruna Herath Date: Thu, 22 Sep 2016 14:57:02 +0530 Subject: [PATCH] Check if we are on storyshots in preview MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit storyshots adds polyfills for window. So preview will incorrectly assume we’re on a browser. This will avoid that. --- src/client/preview/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/client/preview/index.js b/src/client/preview/index.js index 994c8d857e3..0a4118d850e 100644 --- a/src/client/preview/index.js +++ b/src/client/preview/index.js @@ -13,7 +13,8 @@ import { selectStory } from './actions'; import reducer from './reducer'; // check whether we're running on node/browser -const isBrowser = typeof window !== 'undefined'; +const { navigator } = global; +const isBrowser = navigator && navigator. userAgent !== 'storyshots'; const storyStore = new StoryStore(); const reduxStore = createStore(reducer);