From bb7cb66d7e7a39f8d33bf8ef6354f8a35b0c1688 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client/preview/index.js b/src/client/preview/index.js index 994c8d857e3..c83dc7bbd4e 100644 --- a/src/client/preview/index.js +++ b/src/client/preview/index.js @@ -12,8 +12,8 @@ import init from './init'; 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);