From 5a33ea024d9e09f82ba53c8a3601a695d6e4680e Mon Sep 17 00:00:00 2001 From: Atekon Date: Tue, 20 Nov 2018 14:11:43 +0000 Subject: [PATCH] Don't change rootElement when received node is the same --- app/html/src/client/preview/render.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/html/src/client/preview/render.js b/app/html/src/client/preview/render.js index 75484ac511d5..db2632aa91e2 100644 --- a/app/html/src/client/preview/render.js +++ b/app/html/src/client/preview/render.js @@ -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 {