From 30ab5eb65d4d2acfdc4364819da4d5e2a68db5f2 Mon Sep 17 00:00:00 2001 From: Felix <5724535+FelixGraf@users.noreply.github.com> Date: Thu, 13 Apr 2023 14:18:53 +0200 Subject: [PATCH 1/2] fix: only create single-spa-container element when not using replaceMode --- src/single-spa-vue.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/single-spa-vue.js b/src/single-spa-vue.js index d43fc5b..cda6864 100644 --- a/src/single-spa-vue.js +++ b/src/single-spa-vue.js @@ -106,15 +106,15 @@ function mount(opts, mountedInstances, props) { if (!opts.replaceMode) { appOptions.el = appOptions.el + " .single-spa-container"; - } - - // single-spa-vue@>=2 always REPLACES the `el` instead of appending to it. - // We want domEl to stick around and not be replaced. So we tell Vue to mount - // into a container div inside of the main domEl - if (!domEl.querySelector(".single-spa-container")) { - const singleSpaContainer = document.createElement("div"); - singleSpaContainer.className = "single-spa-container"; - domEl.appendChild(singleSpaContainer); + + // single-spa-vue@>=2 always REPLACES the `el` instead of appending to it. + // We want domEl to stick around and not be replaced. So we tell Vue to mount + // into a container div inside of the main domEl + if (!domEl.querySelector(".single-spa-container")) { + const singleSpaContainer = document.createElement("div"); + singleSpaContainer.className = "single-spa-container"; + domEl.appendChild(singleSpaContainer); + } } instance.domEl = domEl; From cc77f7adab6161027c7c1bb229624e2e638a3b44 Mon Sep 17 00:00:00 2001 From: Felix Graf Date: Thu, 13 Apr 2023 14:26:24 +0200 Subject: [PATCH 2/2] style: format code with prettier --- src/single-spa-vue.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/single-spa-vue.js b/src/single-spa-vue.js index cda6864..630a0f9 100644 --- a/src/single-spa-vue.js +++ b/src/single-spa-vue.js @@ -106,7 +106,7 @@ function mount(opts, mountedInstances, props) { if (!opts.replaceMode) { appOptions.el = appOptions.el + " .single-spa-container"; - + // single-spa-vue@>=2 always REPLACES the `el` instead of appending to it. // We want domEl to stick around and not be replaced. So we tell Vue to mount // into a container div inside of the main domEl