Skip to content

Commit fba3a84

Browse files
committed
Check if we are on storyshots in preview
storyshots adds polyfills for window. So preview will incorrectly assume we’re on a browser. This will avoid that.
1 parent e532b4e commit fba3a84

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/client/preview/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@ import init from './init';
1212
import { selectStory } from './actions';
1313
import reducer from './reducer';
1414

15+
// check if we're on storyshots
16+
const { navigator } = global;
17+
const isStoryShots = navigator && navigator.userAgent === 'storyshots';
18+
1519
// check whether we're running on node/browser
16-
const isBrowser = typeof window !== 'undefined';
20+
// storyshots got polyfills for window so need to make sure its not storyshots
21+
const isBrowser = typeof window !== 'undefined' && !isStoryShots;
1722

1823
const storyStore = new StoryStore();
1924
const reduxStore = createStore(reducer);

0 commit comments

Comments
 (0)