Skip to content

Commit

Permalink
Don't change rootElement when received node is the same
Browse files Browse the repository at this point in the history
  • Loading branch information
goncalo-matos committed Nov 22, 2018
1 parent 18586c5 commit 5a33ea0
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion app/html/src/client/preview/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,24 @@ import { stripIndents } from 'common-tags';

const rootElement = document.getElementById('root');

export default function renderMain({ story, selectedKind, selectedStory, showMain, showError }) {
export default function renderMain({
story,
selectedKind,
selectedStory,
showMain,
showError,
forceRender,
}) {
const component = story();

showMain();
if (typeof component === 'string') {
rootElement.innerHTML = component;
} else if (component instanceof Node) {
if (forceRender === true) {
return;
}

rootElement.innerHTML = '';
rootElement.appendChild(component);
} else {
Expand Down

0 comments on commit 5a33ea0

Please sign in to comment.