Merge pull request #10971 from cpgruber/b/ember-double-render

fix ember double render
This commit is contained in:
Norbert de Langen 2020-06-04 20:17:18 +02:00 committed by GitHub
commit 86323b128f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,8 +15,12 @@ const app = window.require(`${window.STORYBOOK_NAME}/app`).default.create({
let lastPromise = app.boot(); let lastPromise = app.boot();
let hasRendered = false; let hasRendered = false;
let isRendering = false;
function render(options: OptionsArgs, el: ElementArgs) { function render(options: OptionsArgs, el: ElementArgs) {
if (isRendering) return;
isRendering = true;
const { template, context = {}, element } = options; const { template, context = {}, element } = options;
if (hasRendered) { if (hasRendered) {
@ -47,6 +51,7 @@ function render(options: OptionsArgs, el: ElementArgs) {
component.appendTo(el); component.appendTo(el);
} }
hasRendered = true; hasRendered = true;
isRendering = false;
return instance; return instance;
}); });