diff --git a/app/react/src/client/index.js b/app/react/src/client/index.js index da10136436bc..889ca11bfa29 100644 --- a/app/react/src/client/index.js +++ b/app/react/src/client/index.js @@ -4,7 +4,14 @@ import deprecate from 'util-deprecate'; import { action as deprecatedAction } from '@storybook/addon-actions'; import { linkTo as deprecatedLinkTo } from '@storybook/addon-links'; -export { storiesOf, setAddon, addDecorator, configure, getStorybook } from './preview'; +export { + storiesOf, + setAddon, + addDecorator, + configure, + getStorybook, + forceReRender, +} from './preview'; export const action = deprecate( deprecatedAction, diff --git a/app/react/src/client/preview/index.js b/app/react/src/client/preview/index.js index 60508441eeee..8aa17f744e8c 100644 --- a/app/react/src/client/preview/index.js +++ b/app/react/src/client/preview/index.js @@ -20,7 +20,13 @@ const isBrowser = !(navigator.userAgent.indexOf('Node.js') > -1); const storyStore = new StoryStore(); -const reduxStore = createStore(reducer); +/* eslint-disable no-underscore-dangle */ +const reduxStore = createStore( + reducer, + window.__REDUX_DEVTOOLS_EXTENSION__ && + window.__REDUX_DEVTOOLS_EXTENSION__({ name: 'Storybook Preview', instanceId: 'sbPreview' }) +); +/* eslint-enable */ const context = { storyStore, reduxStore }; if (isBrowser) { @@ -53,3 +59,5 @@ const renderUI = () => { }; reduxStore.subscribe(renderUI); + +export const forceReRender = () => renderUI();