Skip to content

Commit

Permalink
(#1736) Expose forceReRender over channel
Browse files Browse the repository at this point in the history
  • Loading branch information
dangreenisrael committed Dec 28, 2017
1 parent 4b5622a commit 146229d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
10 changes: 9 additions & 1 deletion app/angular/src/client/preview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ const storyStore = new StoryStore();
const reduxStore = createStore(reducer);
const context = { storyStore, reduxStore };

let channel;
if (isBrowser) {
const queryParams = qs.parse(window.location.search.substring(1));
const channel = createChannel({ page: 'preview' });
channel = createChannel({ page: 'preview' });
channel.on('setCurrentStory', data => {
reduxStore.dispatch(selectStory(data.kind, data.story));
});
Expand Down Expand Up @@ -55,3 +56,10 @@ const renderUI = () => {
reduxStore.subscribe(renderUI);

export const forceReRender = () => render(context, true);

if (isBrowser) {
channel.on('forceReRender', () => {
console.log('force ReRender'); // Remove before merging
forceReRender();
});
}
10 changes: 9 additions & 1 deletion app/react/src/client/preview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ const reduxStore = createStore(reducer);
/* eslint-enable */
const context = { storyStore, reduxStore };

let channel;
if (isBrowser) {
const queryParams = qs.parse(window.location.search.substring(1));
const channel = createChannel({ page: 'preview' });
channel = createChannel({ page: 'preview' });
channel.on('setCurrentStory', data => {
reduxStore.dispatch(selectStory(data.kind, data.story));
});
Expand Down Expand Up @@ -58,3 +59,10 @@ const renderUI = () => {
reduxStore.subscribe(renderUI);

export const forceReRender = () => render(context, true);

if (isBrowser) {
channel.on('forceReRender', () => {
console.log('force ReRender'); // Remove before merging
forceReRender();
});
}
10 changes: 9 additions & 1 deletion app/vue/src/client/preview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ const storyStore = new StoryStore();
const reduxStore = createStore(reducer);
const context = { storyStore, reduxStore };

let channel;
if (isBrowser) {
const queryParams = qs.parse(window.location.search.substring(1));
const channel = createChannel({ page: 'preview' });
channel = createChannel({ page: 'preview' });
channel.on('setCurrentStory', data => {
reduxStore.dispatch(selectStory(data.kind, data.story));
});
Expand Down Expand Up @@ -56,3 +57,10 @@ const renderUI = () => {
reduxStore.subscribe(renderUI);

export const forceReRender = () => render(context, true);

if (isBrowser) {
channel.on('forceReRender', () => {
console.log('force ReRender'); // Remove before merging
forceReRender();
});
}

0 comments on commit 146229d

Please sign in to comment.