Skip to content

Commit

Permalink
Merge pull request #3520 from Grimones/fix-preview-render-order
Browse files Browse the repository at this point in the history
Fix render order in preview
  • Loading branch information
Hypnosphi authored May 2, 2018
2 parents 8c7749c + fda07df commit 3539625
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/angular/src/client/preview/render.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { renderNgApp } from './angular/helpers';

export default function render({ story, showMain }) {
renderNgApp(story);
showMain();
renderNgApp(story);
}
2 changes: 1 addition & 1 deletion app/mithril/src/client/preview/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ export default function renderMain({ story, selectedKind, selectedStory, showMai
return;
}

m.mount(rootEl, { view: () => m(element) });
showMain();
m.mount(rootEl, { view: () => m(element) });
}
3 changes: 2 additions & 1 deletion app/polymer/src/client/preview/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export default function renderMain({ story, selectedKind, selectedStory, showMai
});
return;
}

showMain();
if (typeof component === 'string') {
rootElement.innerHTML = component;
} else if (component instanceof TemplateResult) {
Expand All @@ -28,5 +30,4 @@ export default function renderMain({ story, selectedKind, selectedStory, showMai
rootElement.innerHTML = '';
rootElement.appendChild(component);
}
showMain();
}
2 changes: 1 addition & 1 deletion app/react/src/client/preview/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ export default function renderMain({ story, selectedKind, selectedStory, showMai
// This could leads to issues like below:
// https://github.com/storybooks/react-storybook/issues/81
ReactDOM.unmountComponentAtNode(rootEl);
render(element, rootEl);
showMain();
render(element, rootEl);
}
2 changes: 1 addition & 1 deletion app/vue/src/client/preview/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ export default function render({
return;
}

showMain();
renderRoot({
el: '#root',
render(h) {
return h('div', { attrs: { id: 'root' } }, [h(component)]);
},
});
showMain();
}

0 comments on commit 3539625

Please sign in to comment.